Skip to content

Fix scope disposal bug#16

Merged
estherbrunner merged 2 commits intomainfrom
next
Mar 1, 2026
Merged

Fix scope disposal bug#16
estherbrunner merged 2 commits intomainfrom
next

Conversation

@estherbrunner
Copy link
Copy Markdown
Member

Added

  • New re-exports from @zeix/cause-effect: createSignal, unown, untrack, isObjectOfType, SKIP_EQUALITY, and error classes ReadonlySignalError, RequiredOwnerError, UnsetSignalValueError — previously omitted from Le Truc's public API surface.

Changed

  • @zeix/cause-effect upgraded to 0.18.5: Adds unown() and fixes a scope disposal bug in components connected inside re-runnable effects (see Fixed below).
  • form-checkbox, form-radiogroup, and form-spinbutton examples updated: All three examples now support controlled component usage, accepting externally managed state in addition to their built-in uncontrolled behaviour.

Fixed

  • Scope disposal bug when connectedCallback fires inside a re-runnable effect: createScope inside a reactive effect (e.g. a list-sync effect) registered its dispose on that effect's cleanup list. When the effect re-ran — for example because a MutationObserver fired — it disposed all child scopes including those of already-connected components, silently removing their live event listeners and reactive subscriptions. Fixed by wrapping the connectedCallback body in unown(), detaching each component's scope from the surrounding effect's ownership tree so effect re-runs no longer dispose it.

- Add re-exports from @zeix/cause-effect: createSignal, unown,
  untrack, isObjectOfType, SKIP_EQUALITY
- Add error classes ReadonlySignalError, RequiredOwnerError,
  UnsetSignalValueError
- Upgrade cause-effect to 0.18.5 to fix scope disposal in
  re-runnable effects
- Update examples (form-checkbox, form-radiogroup, form-spinbutton)
  to support controlled usage
- Update CHANGELOG/docs to reflect the new API surface
@estherbrunner estherbrunner merged commit edad4c8 into main Mar 1, 2026
5 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant