Skip to content

Commit

Permalink
feat: validate that window is defined (#229)
Browse files Browse the repository at this point in the history
  • Loading branch information
braianj authored Feb 12, 2025
1 parent 3db69cf commit e863dbd
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion src/components/UserMenu/UserMenu.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,11 @@ const UserMenu = React.memo((props: UserMenuProps) => {

const [isLoadingUserAgentData, userAgentData] = useAdvancedUserAgentData()

const searchParams = new URLSearchParams(window.location.search)
const windowSearchParams =
typeof window !== "undefined"
? new URLSearchParams(window.location.search)
: undefined
const searchParams = new URLSearchParams(windowSearchParams)
const os = searchParams.get("os")
if (userAgentData && os) {
setUserAgentArchitectureDefautlByOs(userAgentData, os as OperativeSystem)
Expand Down

0 comments on commit e863dbd

Please sign in to comment.