Skip to content

Add router.render for waiting on a navigation's data - #829

Open
pleek91 wants to merge 1 commit into
activity-trackerfrom
router-render
Open

Add router.render for waiting on a navigation's data#829
pleek91 wants to merge 1 commit into
activity-trackerfrom
router-render

Conversation

@pleek91

@pleek91 pleek91 commented Aug 29, 2026

Copy link
Copy Markdown
Member

Description

Awaiting push only waits for the route to commit, and props and loaders deliberately don't hold up a navigation. That leaves a server with no point at which the page is renderable, and no way to learn that a props getter or loader redirected or rejected. Without waiting it renders markup for a route it has already left; with something awaiting the data, the abandoning navigation rejects that promise and it renders nothing at all.

router.render resolves once there is nothing left to render, following any navigation the data caused, and reports what a server should respond with. start no longer returns anything.

await router.start()

const response = await router.render()

if (response.status >= 300) {
  return respond(response)
}

const html = await renderToString(app)

The response is derived rather than recorded during navigation because the ordinary 404 sets no rejection at all — it commits the NotFound route — so reading the rejection alone would report 200 for most of them.

@pleek91
pleek91 force-pushed the router-render branch 2 times, most recently from 8fa0622 to 2ef85bd Compare September 1, 2026 20:00
@netlify

netlify Bot commented Sep 2, 2026

Copy link
Copy Markdown

Deploy Preview for kitbag-router ready!

Name Link
🔨 Latest commit 3c3da2f
🔍 Latest deploy log https://app.netlify.com/projects/kitbag-router/deploys/6a9843e4c62f3b0008ec9c0d
😎 Deploy Preview https://deploy-preview-829--kitbag-router.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.

Awaiting push only waits for the route to commit, and props and loaders deliberately do
not hold up a navigation. That leaves a server no point at which the page is renderable,
and no way to learn that a props getter or loader redirected or rejected: without waiting
it renders markup for the route it has already left, and with something awaiting the data
the abandoning navigation rejects that promise and it renders nothing at all.

router.render resolves once there is nothing left to render, following any navigation the
data caused, and reports the status and location a server should respond with. The
response is derived rather than recorded because the ordinary 404 sets no rejection at
all — it commits the NotFound route — so the rejection alone would report 200 for most of
them.
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