Skip to content

Next 14#28

Merged
AprilArcus merged 3 commits intomainfrom
next-14
Apr 15, 2026
Merged

Next 14#28
AprilArcus merged 3 commits intomainfrom
next-14

Conversation

@AprilArcus
Copy link
Copy Markdown
Owner

No description provided.

@AprilArcus AprilArcus force-pushed the next-14 branch 25 times, most recently from f2b5055 to 953e006 Compare April 15, 2026 18:03
Previously, we were packing the properties used by __GRAPHILE_APP__
into the query params of a parsed URL object received by Next.js.
This exploited a loophole by which the `search` field of the URL object
remained the source of truth for navigation, but the `query` field
would be written into `__NEXT_DATA__` whence it could be retrieved by
@app/client/src/pages/_app.tsx upon bootstrap and written into the
window global.

Starting in Next.js 14, if both `search` and `query` are present, search
will take precedence. Injecting these extra properties into the search
segment will cause rehydration errors during navigation due to a
mismatch between the browser history and what Next thinks the search
segment should contain.

In this commit, we change strategies and instead pack the extra props
into the `req` object in @app/server/src/middleware/installSSR.ts,
read them out of `ctx.req` in `MyApp.getInitialProps()` in
@app/client/src/pages/_app.tsx, and return them as part of the props
object. This causes Next to serializes them into the __NEXT_DATA__
bootstrap payload under the `props` key, whence they can be attached to
`window.__GRAPHILE_APP__` as before.

We also add some abstractions in @app/lib to centralize reading and
writing to this global object in a type-safe manner.

unblocks next 14.x
Next 14 wires its custom-server websocket listener lazily from the
request handler path, so reading the fake server's upgrade listener
during SSR middleware installation can miss it. That leaves the central
upgrade dispatcher without a Next handler and causes /_next/webpack-hmr
connections to be destroyed.

Register the Next upgrade dispatcher entry up front, but resolve the
listener from the fake server when a matching upgrade arrives. This keeps
the existing single-server websocket dispatch model without reaching into
Next's private custom-server fields.
@AprilArcus AprilArcus merged commit 65217a7 into main Apr 15, 2026
5 checks passed
@AprilArcus AprilArcus deleted the next-14 branch April 15, 2026 23:06
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