-
-
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
feat: add $app/state
module
#13140
Merged
Merged
feat: add $app/state
module
#13140
+943
−271
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
🦋 Changeset detectedLatest commit: cf41f7e 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 |
preview: https://svelte-dev-git-preview-kit-13140-svelte.vercel.app/ this is an automated message |
dummdidumm
reviewed
Dec 10, 2024
mquandalle
reviewed
Dec 11, 2024
Some thoughts on the migration:
|
dummdidumm
added a commit
to sveltejs/cli
that referenced
this pull request
Dec 12, 2024
A simple, string-based migration for sveltejs/kit#13140 (tested on that repo, zero false-positives, less than five false negatives)
…ests until SvelteKit 3
Co-authored-by: Tee Ming <chewteeming01@gmail.com>
Rich-Harris
commented
Dec 16, 2024
Merged
6 tasks
Rich-Harris
added a commit
to sveltejs/cli
that referenced
this pull request
Dec 16, 2024
* feat: add page-state migration A simple, string-based migration for sveltejs/kit#13140 (tested on that repo, zero false-positives, less than five false negatives) * handle aliases * add migration to docs * update link * lint * rename to app-state * rename * remove .current from navigating references * hopefully this will get it to shut up * add migration task --------- Co-authored-by: Manuel Serret <mserret99@gmail.com> Co-authored-by: Rich Harris <rich.harris@vercel.com>
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Closes #10761
This adds a new
$app/state
module, which is basically the same as the existing$app/stores
module but using Svelte 5 state. (Needless to say, it only works with Svelte 5.)This brings many benefits:
$
prefix! you basically don't need to learn stores any more, except for dealing with legacy codesubscribe
callbacks are synchronous, it's possible to get into a weird state where e.g.$page.url
updates before navigation occurs. We jump through weird hoops (thenotifiable_store
stuff) to prevent this from causing bugs in people's apps$app/stores
(which I'd like to do in SvelteKit 3), we'll no longer need to awkwardly pass stuff into the root componentpage.data
won't cause something that only cares about an unrelated property likepage.status
to re-runRelated PRs:
TODO:
navigating
andupdated
sv migrate
task to automate the migration$app/stores
(the sooner we do this, the less disruptive it'll be when we remove them)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