Skip to content

fix: correct typeof window check in NotFound component for SSR - #676

Open
Chetan175 wants to merge 1 commit into
containers:mainfrom
Chetan175:fix-notfound-ssr
Open

fix: correct typeof window check in NotFound component for SSR#676
Chetan175 wants to merge 1 commit into
containers:mainfrom
Chetan175:fix-notfound-ssr

Conversation

@Chetan175

@Chetan175 Chetan175 commented Aug 12, 2026

Copy link
Copy Markdown

Concisely describe the change

Fixes #679
The NotFound component incorrectly checked for the window object using typeof window !== undefined. Because typeof always returns a string, this check was always evaluating to true, comparing the string "undefined" to the primitive undefined.

This commit updates the check to compare against the string 'undefined', preventing ReferenceErrors when the component is evaluated during Server Side Rendering (SSR) in Docusaurus.

Before screenshot / screen recording

N/A - This is a backend/SSR logic fix, so there are no visual UI changes.

After screenshot / screen recording

N/A - This is a backend/SSR logic fix, so there are no visual UI changes.

Checklist

Ensure you have completed the following checklist for your pull request to be reviewed:

  • Certify you wrote the patch or otherwise have the right to pass it on as an open-source patch by signing all commits. (git commit -s). (If needed, use git commit -s --amend). The author email must match the sign-off email address. See CONTRIBUTING.md for more information.
  • Referenced issues using Fixes: #00000 in commit message (if applicable)
  • PR description, commit message, and GitHub comments are human-written, per LLM Policy

The NotFound component incorrectly checked for the window object using
`typeof window !== undefined`. Because `typeof` always returns a string,
this check was always evaluating to true, comparing the string "undefined"
to the primitive `undefined`.

This commit updates the check to compare against the string `'undefined'`,
preventing ReferenceErrors when the component is evaluated during Server
Side Rendering (SSR) in Docusaurus.

Signed-off-by: Chetan175 <chetanahuja175@gmail.com>
@antedotee

Copy link
Copy Markdown
Contributor

There is no issue being referenced to this PR. In case if the issue hasn't been raised, I believe, you should raise issue for this and reference this PR to that issue.

@Chetan175

Copy link
Copy Markdown
Author

There is no issue being referenced to this PR. In case if the issue hasn't been raised, I believe, you should raise issue for this and reference this PR to that issue.

Thanks for the heads up , i have opened the issue #679 and linked this PR to it

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Bug]: typeof window comparison fails in NotFound component during SSR

2 participants