Skip to content

fix: persist global app state across module graph reloads - #16663

Merged
Rich-Harris merged 3 commits into
version-3from
persist-across-reloads
Aug 5, 2026
Merged

Rich-Harris merged 3 commits into
version-3from
persist-across-reloads

Conversation

@Rich-Harris

Copy link
Copy Markdown
Member

Prevents these annoying errors that sometimes happen when the dev server invalidates the module graph:

No read implementation was provided. Please ensure that your adapter is up to date and supports this feature

This can happen if an entry point is eagerly evaluated before the global state is set. The solution feels a little inelegant but I'm not sure what a better one would look like


Please don't delete this checklist! Before submitting the PR, please make sure you do the following:

Tests

  • Run the tests with pnpm test and lint the project with pnpm lint and pnpm check

Changesets

  • If your PR makes a change that should be noted in one or more packages' changelogs, generate a changeset by running pnpm changeset and following the prompts. Changesets that add features should be minor and those that fix bugs should be patch. Please prefix changeset messages with feat:, fix:, or chore:.

Edits

  • Please ensure that 'Allow edits from maintainers' is checked. PRs without this option may be closed.

@pkg-svelte-dev

ghost commented Aug 5, 2026

Copy link
Copy Markdown

Install the latest version of @sveltejs/kit from b83b2ef:

pnpm add https://pkg.svelte.dev/@sveltejs/kit/c/b83b2effee6705c53f423a0c95c5941d8b8050cc

Open in pkg.svelte.dev: https://pkg.svelte.dev/repos/kit/pr/16663

@changeset-bot

ghost commented Aug 5, 2026

Copy link
Copy Markdown

🦋 Changeset detected

Latest commit: b83b2ef

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 1 package
Name Type
@sveltejs/kit Patch

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

Comment on lines +2 to +4
const state = /** @type {Record<symbol, any>} */ (
/** @type {Record<symbol, unknown>} */ (/** @type {unknown} */ (globalThis))[symbol] ??= {}
);

ghost Aug 5, 2026

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

what on God's green earth is this

ghost Aug 5, 2026

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

He has forsaken this codebase

@svelte-docs-bot

ghost commented Aug 5, 2026

Copy link
Copy Markdown

@Rich-Harris
Rich-Harris merged commit bbd1e2f into version-3 Aug 5, 2026
@Rich-Harris
Rich-Harris deleted the persist-across-reloads branch August 5, 2026 21:45
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants