containers / containers/podman.io
[Bug]: typeof window comparison fails in NotFound component during SSR
- Dominant language
- TypeScript
- Stars
- 108
- Forks
- 188
- Avg merge
- 9d 15h
- Merged PRs (30d)
- 11
Description
### Consisely describe the issue
In `src/theme/NotFound.tsx`, there is an incorrect `typeof` comparison on line 14:
`if (typeof window !== undefined) {`
Because `typeof window` always evaluates to a string (either `"object"` or `"undefined"`), comparing it to the primitive `undefined` is always true.
If the project is ever built or rendered in a Server-Side Rendering (SSR) context where `window` is not defined, the current logic would throw a `ReferenceError: window is not defined` because it attempts to access `window.location.href`.
The comparison should check against the string `'undefined'`
### Upload screenshots or screen recordings
_No response_
### LLM Policy
- [x] This issue is human-written, and folow up comments will also be human-written
Contributor guide
No contributing guide indexed for this repository
Research direction
Open src/theme/NotFound.tsx and inspect the typeof window comparison on line 14, then trace how window.location.href is reached. Verify the corrected guard in an SSR context where window is unavailable; done means the component no longer attempts to access window during server rendering.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- typescript
- Domain
- frontend
- Issue type
- Bug
- Difficulty
- 1/5
- Estimated time
- Under an hour
- Activity status
- Quiet
- Clarity
- Clearly specified
- Newbie friendliness
- 88/100