Skip to content

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

Merged
sissbruecker merged 9 commits intomainfrom
message-list-bind-items
Mar 24, 2026
Merged

feat: add signal bind method to message list component#8783
sissbruecker merged 9 commits intomainfrom
message-list-bind-items

Conversation

@heruan
Copy link
Copy Markdown
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

heruan and others added 3 commits March 17, 2026 10:39
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>
@sissbruecker sissbruecker force-pushed the message-list-bind-items branch from 7fa39af to e3b2279 Compare March 17, 2026 10:58
Copy link
Copy Markdown
Contributor

@DiegoCardoso DiegoCardoso left a comment

Choose a reason for hiding this comment

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

EDIT:
Should we mention in the Javadoc that changes in the signal will trigger a full update on the client?

@heruan
Copy link
Copy Markdown
Member Author

heruan commented Mar 20, 2026

I lost a bit track of this PR, implementation and branch history changed. Are you @sissbruecker taking over this or should I resume it?

@sissbruecker
Copy link
Copy Markdown
Contributor

Yep, I can take care of that.

@sonarqubecloud
Copy link
Copy Markdown

@sissbruecker sissbruecker added this pull request to the merge queue Mar 24, 2026
Merged via the queue into main with commit 374212e Mar 24, 2026
6 checks passed
@sissbruecker sissbruecker deleted the message-list-bind-items branch March 24, 2026 10:09
@github-project-automation github-project-automation Bot moved this from 🔎Iteration reviews to Done in Vaadin Flow | Hilla | Kits ongoing work Mar 24, 2026
@vaadin-bot
Copy link
Copy Markdown
Collaborator

This ticket/PR has been released with Vaadin 25.2.0-alpha2.

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

Projects

Development

Successfully merging this pull request may close these issues.

5 participants