LearnNewsExamplesServices
Frontmatter
id9519
titleSharedWorker: Fix theme resolution for child windows
stateClosed
labels
bugai
assigneestobiu
createdAtMar 19, 2026, 4:13 PM
updatedAtMar 19, 2026, 4:16 PM
githubUrlhttps://github.com/neomjs/neo/issues/9519
authortobiu
commentsCount1
parentIssuenull
subIssues[]
subIssuesCompleted0
subIssuesTotal0
blockedBy[]
blocking[]
closedAtMar 19, 2026, 4:16 PM

SharedWorker: Fix theme resolution for child windows

Closed v12.1.0 bugai
tobiu
tobiu commented on Mar 19, 2026, 4:13 PM

When multiple windows connect to a SharedWorker, they can specify different themes inside their neo-config.json. Currently, the App worker falls back to Neo.config.themes (which is the configuration of the initial window) when resolving and injecting theme files or CSS variables. This can cause child applications to load incorrect themes or fail to load their specific theme files entirely.

This ticket aims to update:

  1. src/worker/App.mjs -> insertThemeFiles() to use Neo.windowConfigs[windowId].themes.
  2. src/worker/App.mjs -> setCssVariable() to use Neo.windowConfigs[windowId].themes.
  3. src/component/Base.mjs -> getTheme() to use Neo.windowConfigs[windowId].themes.
tobiu added the bug label on Mar 19, 2026, 4:13 PM
tobiu added the ai label on Mar 19, 2026, 4:13 PM
tobiu assigned to @tobiu on Mar 19, 2026, 4:13 PM
tobiu referenced in commit 0f04427 - "fix: SharedWorker theme resolution for child windows (#9519)" on Mar 19, 2026, 4:15 PM
tobiu
tobiu Mar 19, 2026, 4:15 PM

Input from Gemini 3.1 Pro:

✦ The theme resolution bug for subsequent windows has been fully resolved.

The core issue was that child applications connecting via SharedWorkers were falling back to the original Portal's Neo.config.themes during CSS injection and variable setting. This caused new windows with distinct theme requirements (e.g. neo-theme-cyberpunk vs neo-theme-dark) to incorrectly inherit the portal's theme rules.

The comprehensive fix decoupled theme operations from the static global Neo.config by ensuring that context is pulled directly from Neo.windowConfigs[windowId]:

  1. src/worker/App.mjs: insertThemeFiles() was updated to use the window-specific configuration object when checking for the presence of themes.
  2. src/worker/App.mjs: setCssVariable() was similarly updated to use the window-specific configuration for setting dynamic CSS variables correctly within the requested theme environment.
  3. src/component/Base.mjs: The getTheme() method, which walks up the VDOM tree, was updated to use Neo.windowConfigs[me.windowId] as the fallback instead of the global Neo.config.

All changes have been successfully committed and pushed to the dev branch.

tobiu closed this issue on Mar 19, 2026, 4:16 PM