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.
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.
Neo.windowConfigs[data.windowId] = Neo.clone(data, true);
Acceptance Criteria:
Neo.windowConfigs stores a deep copy of the registration data.
- Mutating
Neo.config arrays at runtime does not affect the stored window config.
Context: In
src/worker/App.mjs,onRegisterNeoConfigstores the incoming configuration object (msg.data) directly intoNeo.windowConfigsas 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 callsNeo.merge(Neo.config, data)insrc/worker/Base.mjs.The Problem:
Neo.mergeperforms a deep merge for plain Objects but assigns Arrays (and other types) by reference. This meansNeo.configand thedataobject inNeo.windowConfigsshare 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 inNeo.windowConfigs, effectively corrupting the historical record.Neo.windowConfigsshould be an immutable snapshot of the initialization state.Proposed Solution: Deep clone the
dataobject before storing it inNeo.windowConfigsto ensure it remains a pristine snapshot, decoupled from the liveNeo.config.// src/worker/App.mjs Neo.windowConfigs[data.windowId] = Neo.clone(data, true);Acceptance Criteria:
Neo.windowConfigsstores a deep copy of the registration data.Neo.configarrays at runtime does not affect the stored window config.