LearnNewsExamplesServices
Frontmatter
id8306
titleApp Worker: Deep clone config in onRegisterNeoConfig to prevent side effects
stateClosed
labels
bugcore
assigneestobiu
createdAtJan 4, 2026, 11:25 AM
updatedAtJan 4, 2026, 11:35 AM
githubUrlhttps://github.com/neomjs/neo/issues/8306
authortobiu
commentsCount0
parentIssuenull
subIssues[]
subIssuesCompleted0
subIssuesTotal0
blockedBy[]
blocking[]
closedAtJan 4, 2026, 11:35 AM

App Worker: Deep clone config in onRegisterNeoConfig to prevent side effects

Closed v11.18.0 bugcore
tobiu
tobiu commented on Jan 4, 2026, 11:25 AM

Context: In src/worker/App.mjs, onRegisterNeoConfig stores the incoming configuration object (msg.data) directly into Neo.windowConfigs as a historical record of the window's boot configuration.

// src/worker/App.mjs
Neo.windowConfigs[data.windowId] = data;

It also calls super.onRegisterNeoConfig(msg), which eventually calls Neo.merge(Neo.config, data) in src/worker/Base.mjs.

The Problem: Neo.merge performs a deep merge for plain Objects but assigns Arrays (and other types) by reference. This means Neo.config and the data object in Neo.windowConfigs share references to any configuration arrays (e.g., themes, mainThreadAddons).

If the application runtime later mutates these arrays in Neo.config (e.g., Neo.config.themes.push('new-theme')), the modification will be reflected in Neo.windowConfigs, effectively corrupting the historical record. Neo.windowConfigs should be an immutable snapshot of the initialization state.

Proposed Solution: Deep clone the data object before storing it in Neo.windowConfigs to ensure it remains a pristine snapshot, decoupled from the live Neo.config.

// src/worker/App.mjs
Neo.windowConfigs[data.windowId] = Neo.clone(data, true);

Acceptance Criteria:

  1. Neo.windowConfigs stores a deep copy of the registration data.
  2. Mutating Neo.config arrays at runtime does not affect the stored window config.
tobiu added the bug label on Jan 4, 2026, 11:25 AM
tobiu added the core label on Jan 4, 2026, 11:25 AM
tobiu assigned to @tobiu on Jan 4, 2026, 11:26 AM
tobiu referenced in commit c9b25d6 - "App Worker: Deep clone config in onRegisterNeoConfig to prevent side effects #8306" on Jan 4, 2026, 11:35 AM
tobiu closed this issue on Jan 4, 2026, 11:35 AM