-
-
Notifications
You must be signed in to change notification settings - Fork 2k
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
Regression in v2: parent() returns old data even after the parent was invalidated using invalidate() #11696
Comments
Thanks for the information! I hope they tackle this soon as this is a very severe issue for me. |
I'm kinda spooked this is a half year old issue tho |
Partial invalidation has never been fully functional in SvelteKit, even pre 1.0. I suspect none of the maintainers know how to fix it. |
Hasn't it? Tbh I've never had any issues with it in v1 |
You most likely had the double invalidation bug with SK1 without realizing it #10359 since they seem heavily related, but at least it wasn't app breaking. |
@Rich-Harris I'm sorry for mentioning you, as I'm sure you have a lot of work. But you're the author of the original PR which @gterras suspects to be the culprit. Unfortunately, the issues with invalidating have been here for almost half a year, and they seem to progressively get worse. Could you please take a look into this? |
@stalkerg hey! Seeing that you liked the issue, do you have the same problem? |
@kyngs not yet; I did it to improve visibility. Unfortently I have no time now to go deeper and fix it. If nobody fixes it next week, I will try to help. |
I'm experiencing the same issue. In my case, I have a page that calls |
Seems like noone fixed it yet, could you please look into it? |
Is there any movement on this? This is a fairly serious regression, and is preventing us from moving to SK v2. I did create a simple GitHub project that demonstrates the problem, if that helps... https://github.com/denjpeters/SK2Test |
Unfortunately, there is no movement on this. |
Tried to start something here #11819 |
Closing as duplicate of #11446 |
Describe the bug
This is hard to explain, but I'll do my best.
Imagine the following route structure:
The root page shows a basket of fruits, which is loaded from an API in the root +layout.ts. It also includes a button that links to the add page.
The add page includes a button that adds fruit to the basket by posting to the API. After doing so, it invalidates the root +layout.ts load function and then navigates to the root page.
The [id] page only verifies whether a fruit with such an ID exists in the basket. It does that using the +page.ts load function, which fetches the parent using
await parent()
and then observes, whether a fruit with such an ID is in the parent data.Now, let's imagine I do this:
Here's a video where I do that:
simplescreenrecorder-2024-01-20_22.15.00.mp4
However, when I downgrade to sveltekit v1, or use
invalidateAll()
instead ofinvalidate()
, everything works correctly, and theparent()
function returns correct data.Reproduction
SvelteKit v2: https://stackblitz.com/edit/stackblitz-starters-dp4avt?file=src%2Froutes%2F%5Bid%5D%2F%2Bpage.ts
The issue here is easily reproducible as shown in the video
SvelteKit v1: https://stackblitz.com/edit/stackblitz-starters-et87cn?file=src%2Froutes%2F%5Bid%5D%2F%2Bpage.ts
The issue is not reproducible, everything works as expected. See the video:
simplescreenrecorder-2024-01-20_22.24.28.mp4
And as a bonus, SvelteKit v2 using
invalidateAll()
: https://stackblitz.com/edit/stackblitz-starters-4rh3gc?file=src%2Froutes%2Fadd%2F%2Bpage.svelteThe issue is also not reproducible, everything works as expected.
Logs
System Info
Severity
blocking an upgrade
Additional Information
PS: Even though using
invalidateAll
is a workaround, I've decided to use the "blocking an upgrade" severity as rerunning all the load functions is not acceptable.I hope I explained the issue well, if you have any questions, ask me.
The text was updated successfully, but these errors were encountered: