Skip to content
This repository was archived by the owner on Jun 16, 2026. It is now read-only.

fix(useFilterSuggestions): resolve SSR crash by deferring localStorage access#9212

Open
tmdeveloper007 wants to merge 1 commit into
SandeepVashishtha:masterfrom
tmdeveloper007:9206-filtersuggestions-ssr
Open

fix(useFilterSuggestions): resolve SSR crash by deferring localStorage access#9212
tmdeveloper007 wants to merge 1 commit into
SandeepVashishtha:masterfrom
tmdeveloper007:9206-filtersuggestions-ssr

Conversation

@tmdeveloper007

Copy link
Copy Markdown
Contributor

Summary

Replace the globalThis.localStorage default parameter in src/hooks/useFilterSuggestions.js with undefined and access window.localStorage via a conditional expression inside the function body.

Changes

  • Remove globalThis.localStorage from the default parameter
  • Add const effectiveStorage = storage ?? (typeof window !== 'undefined' ? window.localStorage : null)
  • Replace all storage references in the hook body with effectiveStorage

Impact

Fixes server-side rendering crashes. Filter suggestions feature fails during SSR without this fix.

Closes #9206.

…e access

Replace globalThis.localStorage default parameter with undefined and access
window.localStorage inside the function body after an SSR guard.

Closes SandeepVashishtha#9206.
@vercel

vercel Bot commented Jun 15, 2026

Copy link
Copy Markdown
Contributor

@tmdeveloper007 is attempting to deploy a commit to the sandeepvashishtha's projects Team on Vercel.

A member of the Team first needs to authorize it.

@github-actions github-actions Bot added gssoc:approved gssoc approved PR type:bug bug Something isn't working level:beginner 20pts quality:clean 1.2x size/S Small pull request labels Jun 15, 2026
@tmdeveloper007

Copy link
Copy Markdown
Contributor Author

@SandeepVashishtha Ready for review — PR #9212: Fix SSR crash in useFilterSuggestions localStorage default

@codescene-access codescene-access Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Gates Passed
4 Quality Gates Passed

See analysis details in CodeScene

Quality Gate Profile: Clean Code Collective
Install CodeScene MCP: safeguard and uplift AI-generated code. Catch issues early with our IDE extension and CLI tool.

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

Labels

bug Something isn't working gssoc:approved gssoc approved PR level:beginner 20pts quality:clean 1.2x size/S Small pull request type:bug

Projects

None yet

Development

Successfully merging this pull request may close these issues.

fix(src/hooks/useFilterSuggestions.js): resolve SSR crash from globalThis.localStorage default parameter

1 participant