Skip to content

Reactive root per element, and workaround for Solid.js issue preventing some effects from running#67

Merged
trusktr merged 3 commits intomainfrom
reactive-root-per-element
Jan 25, 2026
Merged

Reactive root per element, and workaround for Solid.js issue preventing some effects from running#67
trusktr merged 3 commits intomainfrom
reactive-root-per-element

Conversation

@trusktr
Copy link
Member

@trusktr trusktr commented Jan 25, 2026

see Copilot's description below

Copilot AI review requested due to automatic review settings January 25, 2026 02:51
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This pull request addresses two important issues in the reactive system for custom elements:

  1. Reactive root per element: Previously, child elements created in a parent's template would share the parent's reactive root, causing their effects to be tied to the parent's lifecycle. This prevented proper cleanup when the child element was disconnected independently of the parent.

  2. Solid.js bug workaround: Works around a Solid.js issue (solidjs/solid#2580) where effects created during component render may never run due to reactive tracking issues.

Changes:

  • Added untrack wrapper around super.connectedCallback() in the element decorator to prevent unwanted reactive tracking
  • Implemented per-element reactive roots using Solid.js createRoot, getOwner, and runWithOwner APIs
  • Added proper disposal of reactive roots in disconnectedCallback
  • Removed debug console.log from attribute test

Reviewed changes

Copilot reviewed 5 out of 15 changed files in this pull request and generated 1 comment.

Show a summary per file
File Description
src/decorators/element.ts Added untrack workaround in connectedCallback override to prevent Solid.js bug
src/LumeElement.ts Implemented per-element reactive root creation, storage, and disposal; wrapped effect starts in runWithOwner
src/decorators/element.test.ts Added test case for Solid.js bug workaround with createSignal and render
src/decorators/attribute.test.ts Removed debug console.log statement
src/LumeElement.test.ts Added test for independent effect lifecycle management of child elements
dist/* Generated build artifacts reflecting source changes

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@trusktr trusktr force-pushed the reactive-root-per-element branch from cb39144 to 4eed14d Compare January 25, 2026 03:00
@trusktr trusktr merged commit 04ff2ad into main Jan 25, 2026
3 checks passed
@trusktr trusktr deleted the reactive-root-per-element branch January 25, 2026 03:09
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