Skip to content

feat: add signal bind method to message list component#8783

Open
heruan wants to merge 2 commits intomainfrom
message-list-bind-items
Open

feat: add signal bind method to message list component#8783
heruan wants to merge 2 commits intomainfrom
message-list-bind-items

Conversation

@heruan
Copy link
Member

@heruan heruan commented Feb 25, 2026

Summary

  • Add bindItems(Signal<List<S>>) method and signal-based constructor to MessageList, allowing items to be reactively bound to signals
  • Extract private updateItems() from setItems() for reuse by the signal effect callback
  • Guard setItems() and addItem() with throwIfItemsBindingActive() to prevent manual mutation while a signal binding is active

Test plan

  • Unit tests: 11 tests in MessageListSignalTest covering signal constructor, reactive updates (list and item signals), deferred activation until attach, and error cases
  • Integration tests: 5 tests in MessageListSignalIT covering initial render, add, remove, update, and add+remove via signal-bound page
  • All existing MessageList unit tests still pass

🤖 Generated with Claude Code

Add `bindItems(Signal<List<S>>)` method and a signal-based constructor
to MessageList, allowing items to be reactively bound to signals. The
rendered messages update automatically when the list signal or any
individual item signal changes.

Implementation details:
- Extract private `updateItems()` from `setItems()` for reuse by the
  signal effect callback
- Guard `setItems()` and `addItem()` with `throwIfItemsBindingActive()`
  to prevent manual mutation while a signal binding is active
- Use `SignalBindingFeature` for binding lifecycle management
- Add unit tests covering signal constructor, reactive updates for both
  list and item signals, deferred activation until attach, and error
  cases (mutation while bound, double bind, null signal)
- Add manual test page and integration tests for signal binding

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@sonarqubecloud
Copy link

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: 🔎Iteration reviews

Development

Successfully merging this pull request may close these issues.

2 participants