Skip to content

fix(data-grid): prevent fetch rejection during prerendering - #1074

Merged
sadmann7 merged 6 commits into
mainfrom
sadman/fix-prerender-fetch-error
Dec 18, 2025
Merged

sadmann7 merged 6 commits into
mainfrom
sadman/fix-prerender-fetch-error

Conversation

@sadmann7

Copy link
Copy Markdown
Owner

No description provided.

Copilot AI review requested due to automatic review settings December 18, 2025 02:10
@vercel

vercel Bot commented Dec 18, 2025 •

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Review Updated (UTC)
tablecn Ready Ready Preview, Comment Dec 18, 2025 2:12am

@sadmann7
sadmann7 merged commit f459b0e into main Dec 18, 2025
6 checks passed

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

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: false is 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.

Comment thread src/app/data-grid-live/page.tsx
@sadmann7
sadmann7 deleted the sadman/fix-prerender-fetch-error branch December 18, 2025 02:14
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

1 active deployment
Preview – tablecn — 0768d4fd Deployed Dec 18, 2025 by vercel[bot]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants