Skip to content

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

Description

@Chetan175

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

  • This issue is human-written, and folow up comments will also be human-written

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions