-
Notifications
You must be signed in to change notification settings - Fork 0
Open
Labels
bugSomething isn't workingSomething isn't working
Description
Problem
The useWindowResize hook currently assumes that the window object is always available. This causes errors when rendering on the server (such as in SSR or during static builds), where the window object is not defined.
Suggested Solution
- Update the hook to check if the
windowobject is available before attempting to access its properties (innerWidth/innerHeight), such as in the initial state function and within the resize handler. - Return default dimensions if
windowis not present to avoid runtime errors. - Optionally, skip attaching event listeners on the server.
Acceptance Criteria
- The hook no longer throws a "window is not defined" error in SSR environments.
- The functionality is preserved for client-side usage.
File: src/hooks/useWindowResize.ts
Copilot
Metadata
Metadata
Assignees
Labels
bugSomething isn't workingSomething isn't working