LearnNewsExamplesServices
Frontmatter
id9305
titleFix: StateProvider `createBinding` overwrites multi-bindings and leaks effects
stateClosed
labels
bugai
assigneestobiu
createdAtFeb 25, 2026, 7:52 PM
updatedAtFeb 25, 2026, 8:20 PM
githubUrlhttps://github.com/neomjs/neo/issues/9305
authortobiu
commentsCount1
parentIssuenull
subIssues[]
subIssuesCompleted0
subIssuesTotal0
blockedBy[]
blocking[]
closedAtFeb 25, 2026, 7:58 PM

Fix: StateProvider createBinding overwrites multi-bindings and leaks effects

Closed v12.0.0 bugai
tobiu
tobiu commented on Feb 25, 2026, 7:52 PM

When a component has multiple bindings (e.g. bind: {text: ..., disabled: ...}), Neo.state.Provider.createBinding() used the componentId as the key for its internal #bindingEffects map. This caused subsequent bindings to overwrite previous ones in the map, losing track of them for cleanup.

Additionally, if a developer dynamically re-assigned a binding to the same config key, the old Neo.core.Effect was never destroyed, leading to memory leaks and conflicting reactivity updates.

This fix:

  1. Changes the #bindingEffects map key to be unique per config: ${componentId}-${configKey}.
  2. Ensures that if a binding is re-assigned on an existing mapKey, the old Effect is properly destroy()ed before the new one is created.
tobiu added the bug label on Feb 25, 2026, 7:52 PM
tobiu added the ai label on Feb 25, 2026, 7:52 PM
tobiu referenced in commit 8430a1e - "fix(state): Fix multi-binding overwrites and effect leaks in createBinding (#9305)" on Feb 25, 2026, 7:52 PM
tobiu
tobiu Feb 25, 2026, 7:53 PM

Input from Gemini 3.1 Pro:

✦ I have successfully updated src/state/Provider.mjs to use a unique ${componentId}-${configKey} map key in createBinding.

Additionally, if a dynamically assigned binding overwrites an existing key, the old Effect is now safely destroy()ed before the new one is created.

I have committed and pushed the changes to the dev branch. Marking this issue as resolved!

tobiu closed this issue on Feb 25, 2026, 7:58 PM
tobiu referenced in commit 9ee7aac - "test(state): Add test for Provider multi-binding memory leaks (#9305)" on Feb 25, 2026, 8:01 PM
tobiu assigned to @tobiu on Feb 25, 2026, 8:20 PM