-
-
Notifications
You must be signed in to change notification settings - Fork 2.1k
fix: preserve $page.state when invalidating #11810
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
base: main
Are you sure you want to change the base?
fix: preserve $page.state when invalidating #11810
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 |
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.
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 |
This comment was marked as duplicate.
This comment was marked as duplicate.
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.
I think this makes sense, but will discuss with other maintainer to get agreement on whether this is a bugfix or expected behavior
This comment was marked as duplicate.
This comment was marked as duplicate.
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 test
and lint the project withpnpm lint
andpnpm check
Changesets
pnpm changeset
and following the prompts. Changesets that add features should beminor
and those that fix bugs should bepatch
. Please prefix changeset messages withfeat:
,fix:
, orchore:
.Edits