-
-
Notifications
You must be signed in to change notification settings - Fork 3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
fix: no hydration when new promise comes in #8383
base: main
Are you sure you want to change the base?
fix: no hydration when new promise comes in #8383
Conversation
☁️ Nx Cloud ReportCI is running/has finished running commands for commit 85ee5bc. As they complete they will appear below. Click to see the status, the terminal output, and the build insights. 📂 See all runs for this CI Pipeline Execution
✅ Successfully ran 1 targetSent with 💌 from NxCloud. |
before digging deeper, can you confirm if this is a bug or expected @TkDodo ? I think we might not be in a pending state so the promise doesn't get sent down? |
// --- server --- | ||
countRef.current++ | ||
const promise2 = serverQueryClient.prefetchQuery(query) | ||
|
||
const dehydrated2 = dehydrate(serverQueryClient) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
assume this is a server fn calling revalidatePath()
so the page re-renders
you’re right: we only send the promise when we are in |
feels like we need some other state that would let us know if the promise is fresher then we need to set the queries' promise or something.. this goes deeper than I thought |
I'd say if we get a promise, we should always assume it's newer and hydrate its data, no? |
how do we check for that wihtout causing infinite re-renders in |
struggling to figuring out how to properly filter out the queries to put in the hydration queue CleanShot.2024-12-02.at.21.01.26.mp4 |
@juliusmarminge have you widened this check? query/packages/react-query/src/HydrationBoundary.tsx Lines 74 to 76 in 8fe9010
to something like:
so that whenever a promise is included, we put it the queue. |
yea that causes infinite rerenders |
interesting; let’s debug that together today if you have some time? |
sure! what time? I can sneak in a short seesion anytime after 10am gmt+1. |
I pinged you on discord ;) |
existingQuery.state.dataUpdatedAt | ||
existingQuery.state.dataUpdatedAt || | ||
// @ts-expect-error | ||
dehydratedQuery.promise?.status !== existingQuery.promise?.status |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this might actually be working
No description provided.