docs: keep dehydrated serializable on flight requests in the Next pages example - #251
Merged
Merged
Conversation
…ages example The characters page of the Next pages example skipped dehydration on flight requests by leaving `dehydrated` undefined, and Next rejects an explicitly undefined `getServerSideProps` prop in development: every client-side navigation to `/characters` answered the data request with a 500 and fell back to a full reload. The page is back to `!isFlight(...) && await dehydrate(...)`, the form it had before the navigation setup needed two statements, so a flight request returns `false`, which Next serializes and `HydrationProvider` treats as "skip hydration".
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #251 +/- ##
==========================================
+ Coverage 83.29% 83.33% +0.03%
==========================================
Files 98 98
Lines 2556 2556
Branches 551 551
==========================================
+ Hits 2129 2130 +1
Misses 314 314
+ Partials 113 112 -1 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
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.
Why
src/pages/characters.tsxin the Next pages example skips dehydration on flight requests:Next rejects an explicitly
undefinedprop returned fromgetServerSidePropsin development (isSerializableProps, enabled under the dev server and build-time SSG). Reproduced withNANO_KIT_DEV=1 next dev --webpackand a real click on the CHARACTERS link from/episodes:Production is unaffected, since
JSON.stringifydrops the key, but the example demonstrates exactly the scenario that breaks innext dev.What
The page is back to the single expression it had before 33b6e0b, which only switched to
letbecause the navigation setup took two statements at the time:A flight request now returns
false, which Next serializes andHydrationProvidertreats as "skip hydration".Checks
_next/data/development/characters.jsonanswers 200, no document request follows, the console is clean.oxlinton the file passes. The example'stscreports only pre-existing noise from generated.nexttypes andimport.meta.envin the symlinked package sources.