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

fix(useCSVExport): add document guard to prevent SSR crash in exportToCSV#9213

Open
tmdeveloper007 wants to merge 1 commit into
SandeepVashishtha:masterfrom
tmdeveloper007:9207-csvexport-docguard
Open

fix(useCSVExport): add document guard to prevent SSR crash in exportToCSV#9213
tmdeveloper007 wants to merge 1 commit into
SandeepVashishtha:masterfrom
tmdeveloper007:9207-csvexport-docguard

Conversation

@tmdeveloper007

Copy link
Copy Markdown
Contributor

Summary

Add a typeof document === 'undefined' guard at the top of the exportToCSV callback in src/hooks/useCSVExport.js. While exportToCSV is typically called from user events (not during SSR), this adds defensive programming to prevent crashes if the code path is ever reached in a server context.

Changes

  • Add if (typeof document === 'undefined') return; as the first line of exportToCSV

Impact

Prevents potential SSR/hydration crashes. Adds defensive programming safety.

Closes #9207.

@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.

@tmdeveloper007

Copy link
Copy Markdown
Contributor Author

@SandeepVashishtha Ready for review — PR #9213: Add document guard to useCSVExport exportToCSV

@github-actions github-actions Bot added quality:clean 1.2x size/XS Extra-small pull request labels Jun 15, 2026

@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/XS Extra-small pull request type:bug type:docs type:feature

Projects

None yet

Development

Successfully merging this pull request may close these issues.

fix(src/hooks/useCSVExport.js): add document guard to prevent SSR crash in exportToCSV

1 participant