Conversation
|
The latest updates on your projects. Learn more about Vercel for Git ↗︎
|
commit: |
1. Trigger the state sync effect on the state keys only (as the keyMap is not usually referentially stable) 2. Build the queryRef from the tracked keys, not all search params (which may be empty), and fix undefined vs null access when parsing. 3. When parsing, check if there is at least one miss before updating the state (which causes a re-render).
Somehow wrapping the URL update in a startTransition causes a lot more re-renders.
Render counts seem to be highly susceptible to variance when the CPU is under load (eg: running `pnpm run test` on the whole codebase on an older machine), so we're increasing the number of retries for those tests (but only in CI, as we want them to fail fast in local development).
5363f1c to
97b127e
Compare
|
🎉 This PR is included in version 2.3.1-beta.2 🎉 The release is available on: Your semantic-release bot 📦🚀 |
This was referenced Jan 8, 2025
This was
linked to
issues
Jan 8, 2025
|
🎉 This PR is included in version 2.3.1 🎉 The release is available on: Your semantic-release bot 📦🚀 |
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.
The optimal number of renders should be:
Progress
useQueryStatesnow renders only once on mount (was 2 renders previously)useQueryStatesnow renders one less time (detecting query cache hits)shallow: false.Baseline
Tasks
startTransitioncauses 4 renders in the pages router -> maybe the isLoading flag?Click to expand
Render count - app router - useQueryState - shallow: false, history: push, startTransition: true render ✓ should render once on mount (84ms) render (Attempt 1 of 2) should then render 3 times on updates cy:command ✔ visit /app/render-count/useQueryState/false/push/true?delay=0 cy:command ✔ contains #hydration-marker, hydrated cy:command ✔ assert expected **<div#hydration-marker>** to be **hidden** cy:command ✔ stub-1 log("render") cy:command ✔ get button cy:command ✔ click cy:command ✔ stub-1 log("render") cy:command ✔ stub-1 log("render") cy:command ✔ new url http://localhost:3001/base/app/render-count/useQueryState/false/push/true?delay=0&test=pass cy:fetch ➟ GET http://localhost:3001/base/app/render-count/useQueryState/false/push/true?delay=0&test=pass&_rsc=vqr5f Status: 200 cy:command ✔ stub-1 log("render") cy:command ✔ stub-1 log("render") cy:command ✔ get @consoleLog cy:command ✘ assert expected **5** to equal **4** Actual: 5 Expected: 4 render 1) should then render 3 times on updates cy:command ✔ visit /app/render-count/useQueryState/false/push/true?delay=0 cy:command ✔ contains #hydration-marker, hydrated cy:command ✔ assert expected **<div#hydration-marker>** to be **hidden** cy:command ✔ stub-1 log("render") cy:command ✔ get button cy:command ✔ click cy:command ✔ stub-1 log("render") cy:command ✔ stub-1 log("render") cy:command ✔ new url http://localhost:3001/base/app/render-count/useQueryState/false/push/true?delay=0&test=pass cy:fetch ➟ GET http://localhost:3001/base/app/render-count/useQueryState/false/push/true?delay=0&test=pass&_rsc=vqr5f Status: 200 cy:command ✔ get @consoleLog cy:command ✘ assert expected **3** to equal **4** Actual: 3 Expected: 4 cy:command ✔ stub-1 log("render")Notes