-
-
Notifications
You must be signed in to change notification settings - Fork 1.9k
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
client side navigation incorrectly re-uses data
from previous request
#8272
Comments
I'm having the same issue where client-side navigations re-use data from the previous route, but the workaround (creating an empty +page.server.ts) doesn't work for me. update: I finally found my issue and I'm not sure it's related: The content of my page uses an {#each} loop to map blocks in PageData to components. Client-side navigation would result in some page data changing, but not all of the content would change, so the page would have some content from the previous route. Adding a key to the loop fixed this. The other issue was with the sticky anchor navigation component not updating with client-side navigation. I fixed this with a reactive variable. I didn't expect to have to use reactive variables with pre-rendered content. Maybe this is unintended and related to #8302 |
@bbozzay for me your issues don't look like they are related to this one.
Sounds like intended. This is how
Without knowing your code, I can only assume that this is also something that works like intended. If you don't use reactive statements, the DOM will not update if your data changes. |
Note: #7967 got fixed, so now you have to add an empty |
https://github.com/coyotte508/sveltekit-load-bug - I think I encountered the same issue, here's a minimal repo Here's a simpler description: When But if I navigate to another page without |
After digging into it, the backend will return |
fixes sveltejs#8272 When going from a page with server load to a page without server load, the cache wasn't purged properly
fixes sveltejs#8272 When going from a page with server load to a page without server load, the cache wasn't purged properly
fixes #8272 When going from a page with server load to a page without server load, the cache wasn't purged properly --------- Co-authored-by: Simon H <5968653+dummdidumm@users.noreply.github.com>
Describe the bug
The
load_route
function re-uses data from a previous result ifloaders
array does not have any data to load at a specific index. In my case I first load data where 5 differentloaders
are involved. On the next page (which includes a layout reset) only 3 loaders are involved. The last one does not provide any data andSvelteKit
uses thedata
from the previous request, which is wrong since that data should not be involved in the rendering process becasue of the layout reset.Marked in red is the
data
at the specific index that causes the issue. The first log comes from the initial page load. The second log is a client-side navigation and the third on is a page reload. Marked in orange is thedata
that get's set incorrectly from the previous response. It should actully benull
like in log line nr 3.My specific use case works if I delete this line. But I don't fully understand everything that happens here. Something in this invalidation logic is wrong. Or maybe the code where
branch_promises
gets set.The whole
data
logic seems really buggy (see #8157).Reproduction
I'm sorry, I was not able to reproduce this in a fresh repo in the limited time I had.
Let me know if the description isn't enough and I will try to find some time to create a stackblitz example.
Logs
No response
System Info
Severity
serious, but I can work around it
Additional Information
My current workaround is it to create an empty
+page.server.ts
. The file does not need to export aload
function. The simple presence of that file is enough (see #7967).The text was updated successfully, but these errors were encountered: