Skip to content

refactor: prefetch route data in loaders and use suspense queries - #304

Open
Tomahawk2191 wants to merge 3 commits into
refactor/data-routerfrom
refactor/route-loaders
Open

Tomahawk2191 wants to merge 3 commits into
refactor/data-routerfrom
refactor/route-loaders

Conversation

@Tomahawk2191

@Tomahawk2191 Tomahawk2191 commented Nov 14, 2026 •

Copy link
Copy Markdown
Collaborator

What was the ticket?

N/A

What did I do?

Part 4 of 5. Stack: #301 → #302 → #303 → #304 → #305. Review and merge in order.

Starts page data in route loaders and moves sections to suspense queries.

  • The landing and apply route loaders call queryClient.prefetchQuery for each query the page needs without awaiting, so fetches start as soon as navigation does and the page paints immediately.
  • Sanity-backed sections use useSuspenseQuery and are each wrapped in a new SectionBoundary (react-error-boundary + Suspense, both rendering nothing). A slow or failed query only blanks its own section.
  • On the apply page, the header and nav render right away; only the team columns wait on Sanity.
  • Queries retry twice before a section gives up.
  • Root shows a thin progress bar while a navigation is loading.
  • Adds the react-error-boundary dependency.

How did I test it?

Ran bun run lint, bun run typecheck, oxfmt --check and bun run build on this branch; all pass. e2e and manual browser testing still to do.

Required checks:

  • Did you conduct a self-review?
  • Have you written unit or integration tests?

What could go wrong in the future? What parts of your code should the reviewer pay the most attention to?

  • New Sanity-backed sections need to be wrapped in SectionBoundary and have their query added to the route's prefetch, or a failure will bubble to the route error page.
  • Sections fail silently (render nothing) on error, so outages show up as missing content rather than an error.

Additional Comments for the Reviewers

Screenshots

N/A, no visual changes intended.

@Tomahawk2191
Tomahawk2191 added this pull request to stack #306 November 14, 2026 19:23
@netlify

netlify Bot commented Nov 14, 2026 •

Copy link
Copy Markdown

✅ Deploy Preview for generatenu-website ready!

Name Link
🔨 Latest commit 050f749
🔍 Latest deploy log https://app.netlify.com/projects/generatenu-website/deploys/6af8c8cac854ad610b3ef7cf
😎 Deploy Preview https://deploy-preview-304--generatenu-website.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.
🤖 Make changes Run an agent on this branch

To edit notification comments on pull requests, go to your Netlify project configuration.

@Tomahawk2191
Tomahawk2191 marked this pull request as ready for review November 14, 2026 20:28
@Tomahawk2191
Tomahawk2191 requested a review from a team as a code owner November 14, 2026 20:28
@Tomahawk2191
Tomahawk2191 force-pushed the refactor/route-loaders branch from f11ead0 to 61c8e0b Compare November 14, 2026 20:35

This branch has not been deployed

No deployments
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.

1 participant