Repository navigation
fix(data-grid): prevent fetch rejection during prerendering - #1074
Merged
Merged
Conversation
…ection Suspense alone doesn't prevent SSR - useLiveQuery requires getServerSnapshot and collection preload triggers fetch() which rejects during prerendering
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
Contributor
There was a problem hiding this comment.
Pull request overview
This PR fixes a fetch rejection error that occurred during Next.js prerendering by relocating the skatersCollection.preload() call from the page component to the dynamically imported client component. The fix leverages the existing ssr: false configuration on the dynamic import to ensure the preload operation only executes client-side, avoiding fetch errors during the build/prerender phase.
Key changes:
- Moved
use(skatersCollection.preload())from page.tsx to data-grid-live-demo.tsx to prevent execution during prerendering - Enhanced comment documentation explaining why
ssr: falseis required (useSyncExternalStore + fetch during prerendering) - Updated skeleton loading state to include a 4th button (matching the actual toolbar) with responsive visibility
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.
| File | Description |
|---|---|
| src/app/data-grid-live/page.tsx | Removed preload call and unused imports; updated comment to explain both SSR issues; adjusted skeleton widths and added 4th skeleton button with lg:block |
| src/app/data-grid-live/components/data-grid-live-demo.tsx | Added preload call inside the client component where it executes after SSR phase; added use import from React |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
anhdd-kuro
pushed a commit
to anhdd-kuro/tablecn
that referenced
this pull request
Apr 8, 2026
…#1074) * fix: avoid fetch during prerender in data-grid-live page * fix: move collection preload to client component to avoid prerender fetch rejection * fix: use dynamic import with ssr:false to prevent prerender fetch rejection Suspense alone doesn't prevent SSR - useLiveQuery requires getServerSnapshot and collection preload triggers fetch() which rejects during prerendering * fix: add 'use client' directive for dynamic import with ssr:false * refactor: skeeleton layout * refactor: skeeleton size
This branch was successfully deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
No description provided.