Skip to content

fix(core): allow duplicate qwik via shared singletons#8609

Open
wmertens wants to merge 2 commits into
build/v2from
singletons
Open

fix(core): allow duplicate qwik via shared singletons#8609
wmertens wants to merge 2 commits into
build/v2from
singletons

Conversation

@wmertens
Copy link
Copy Markdown
Member

@wmertens wmertens commented May 2, 2026

Another step towards QwikDev/qwik-evolution#318

Copilot AI review requested due to automatic review settings May 2, 2026 22:01
@wmertens wmertens requested a review from a team as a code owner May 2, 2026 22:01
@changeset-bot
Copy link
Copy Markdown

changeset-bot Bot commented May 2, 2026

🦋 Changeset detected

Latest commit: c0af151

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

This PR includes changesets to release 5 packages
Name Type
@qwik.dev/core Patch
eslint-plugin-qwik Patch
@qwik.dev/react Patch
@qwik.dev/router Patch
create-qwik 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

@maiieul maiieul moved this from Backlog to Waiting For Review in Qwik Development May 2, 2026
@pkg-pr-new
Copy link
Copy Markdown

pkg-pr-new Bot commented May 2, 2026

Open in StackBlitz

@qwik.dev/core

npm i https://pkg.pr.new/QwikDev/qwik/@qwik.dev/core@8609

@qwik.dev/router

npm i https://pkg.pr.new/QwikDev/qwik/@qwik.dev/router@8609

eslint-plugin-qwik

npm i https://pkg.pr.new/QwikDev/qwik/eslint-plugin-qwik@8609

create-qwik

npm i https://pkg.pr.new/QwikDev/qwik/create-qwik@8609

@qwik.dev/optimizer

npm i https://pkg.pr.new/QwikDev/qwik/@qwik.dev/optimizer@8609

commit: c0af151

Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This PR refactors selected mutable runtime state into a version-aware global singleton registry so same-version Qwik copies can share state, primarily to support externalized third-party Qwik libraries on the server without tripping duplicate-runtime issues.

Changes:

  • Added a new shared/singletons registry on globalThis.__qwik__ and moved several runtime registries/state holders to use it.
  • Updated server/testing symbol resolution and build-time allowlists so the new singleton/version plumbing can be imported in server/optimizer builds.
  • Added/updated tests and a changeset describing the shared-singleton behavior.

Reviewed changes

Copilot reviewed 15 out of 15 changed files in this pull request and generated 3 comments.

Show a summary per file
File Description
scripts/submodule-server.ts Allows core/version imports in the server submodule build.
scripts/submodule-optimizer.ts Allows core/version imports in the optimizer submodule build.
packages/qwik/src/testing/platform.ts Switches test symbol lookup to the shared singleton registry.
packages/qwik/src/server/qwik-copy.ts Re-exports the singleton accessor for server runtime code.
packages/qwik/src/server/platform.unit.ts Updates server platform tests to use _regSymbol/new global state.
packages/qwik/src/server/platform.ts Switches server symbol lookup/chunk mapping checks to shared singletons.
packages/qwik/src/core/use/use-locale.ts Moves locale and async-local storage handles into singleton-backed state.
packages/qwik/src/core/shared/singletons.ts Introduces the new global singleton registry and duplicate-version check.
packages/qwik/src/core/shared/serdes/inflate.ts Moves deserialization loading state into the singleton registry.
packages/qwik/src/core/shared/serdes/deser-proxy.ts Moves deserializer proxy cache into the singleton registry.
packages/qwik/src/core/shared/serdes/allocate.ts Moves deserialization resolver/store-target maps into the singleton registry.
packages/qwik/src/core/shared/qrl/qrl.ts Registers inline QRL symbols via the singleton-backed registry.
packages/qwik/src/core/shared/qrl/qrl-class.ts Reads the singleton-backed deserialization loading state.
packages/qwik/src/core/index.ts Replaces inline duplicate-import guard with singleton module side effect import.
.changeset/shared-singletons-global.md Records the patch release note for shared global singletons.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread packages/qwik/src/core/shared/qrl/qrl.ts Outdated
Comment thread packages/qwik/src/server/platform.unit.ts
Comment thread packages/qwik/src/core/shared/singletons.ts
@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented May 2, 2026

built with Refined Cloudflare Pages Action

⚡ Cloudflare Pages Deployment

Name Status Preview Last Commit
qwik-docs ✅ Ready (View Log) Visit Preview c0af151

@wmertens
Copy link
Copy Markdown
Member Author

wmertens commented May 3, 2026

hmm _captures is also a singleton, we need to change it to a holder object

@thejackshelton thejackshelton marked this pull request as draft May 19, 2026 06:00
@maiieul maiieul moved this from Waiting For Review to In progress in Qwik Development May 19, 2026
@wmertens wmertens marked this pull request as ready for review May 20, 2026 15:19
@wmertens wmertens requested review from a team as code owners May 20, 2026 15:19
@maiieul maiieul moved this from In progress to Waiting For Review in Qwik Development May 20, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: Waiting For Review

Development

Successfully merging this pull request may close these issues.

3 participants