fix: preserve $page.state when invalidating#11810
fix: preserve $page.state when invalidating#11810PatrickG wants to merge 14 commits intosveltejs:version-3from
Conversation
🦋 Changeset detectedLatest commit: ba17182 The changes in this PR will be included in the next version bump. This PR includes changesets to release 1 package
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
dummdidumm
left a comment
There was a problem hiding this comment.
You hunch is right. I think the better fix is to add similar logic to the form logic: get_navigation_result_from_branch optionally accepts a state property, which defaults to the empty object. It's set nowhere except the call site where that form invalidate logic is, i.e. state: invalidating ? page.state : {}
|
@dummdidumm Do you mean like this? |
This comment was marked as duplicate.
This comment was marked as duplicate.
|
Just ran into this. Would love to see a fix. The native |
|
This seems to resolve it #11956 (comment) |
This PR does not fix #11956. It only fixes losing |
dummdidumm
left a comment
There was a problem hiding this comment.
I think this makes sense, but will discuss with other maintainer to get agreement on whether this is a bugfix or expected behavior
|
With the merge of the remote functions PR, this is basically implemented in the (hacky) way I tried first. kit/packages/kit/src/runtime/client/client.js Line 385 in dada03f But reset_page_state is only false when calling refreshAll(). IMO it should default to false when calling invalidate(...) and invalidateAll() as well, with an option to enable resetting the page state.I'll update this PR. |
Fix #11783
I'm not sure if this is the correct fix or if it should be fixed in
load_route()/get_navigation_result_from_branch()because this linekit/packages/kit/src/runtime/client/client.js
Line 988 in c749e85
threw me off a bit.
This is what we need for the page state as well.
Changing this line
kit/packages/kit/src/runtime/client/client.js
Line 531 in c749e85
to
Seems to pass all tests as well. But I'm not sure if this could lead to unexpected behavior.
Please don't delete this checklist! Before submitting the PR, please make sure you do the following:
Tests
pnpm testand lint the project withpnpm lintandpnpm checkChangesets
pnpm changesetand following the prompts. Changesets that add features should beminorand those that fix bugs should bepatch. Please prefix changeset messages withfeat:,fix:, orchore:.Edits