Skip to content

feat: add bulk insert methods to ListSignal and SharedListSignal#24026

Open
Artur- wants to merge 11 commits intomainfrom
feature/listsignal-insertall
Open

feat: add bulk insert methods to ListSignal and SharedListSignal#24026
Artur- wants to merge 11 commits intomainfrom
feature/listsignal-insertall

Conversation

@Artur-
Copy link
Copy Markdown
Member

@Artur- Artur- commented Mar 26, 2026

Add insertAllLast, insertAllFirst, and insertAllAt to ListSignal that perform the entire batch with a single notification. Add insertAllLast, insertAllFirst and insertAllAt to SharedListSignal using transactions for atomicity.

Artur- added 8 commits March 26, 2026 14:57
Add insertAllLast, insertAllFirst, and insertAllAt to ListSignal that
perform the entire batch with a single notification. Add insertAllLast
and insertAllFirst to SharedListSignal using transactions for atomicity.
…bulk insert methods

Extract createSignals() and insertAllAtInternal() private helpers so that
insertAllLast, insertAllFirst, and insertAllAt all delegate to a single
code path for signal creation and list construction.
Adds insertAllAt(Collection, ListPosition) to SharedListSignal, matching
the API symmetry with ListSignal which already has insertAllAt.
Delegate insertAllFirst and insertAllLast to insertAllAt instead of
duplicating the transaction and iteration logic. This removes the
reverse-iterate-then-reverse-ops approach in insertAllFirst.
…ture

insertAllFirst now delegates to insertAllAt(0, values), reducing the
boilerplate while insertAllLast keeps its own lock block to safely
compute the current size inside the lock.
The collection parameter must not be null, but individual null values
within the collection are allowed when the element type permits null,
consistent with the single-insert methods.
…actions

Nested transaction support is tested by calling insertAllLast and
insertAllFirst from within a Signal.runInTransaction block.
Covers the missing test gap where insertAllFirst with an empty
collection was not verified to be a no-op.
@Artur- Artur- requested a review from Legioth March 26, 2026 15:14
@github-actions
Copy link
Copy Markdown

github-actions bot commented Mar 26, 2026

Test Results

 1 386 files  ± 0   1 386 suites  ±0   1h 23m 2s ⏱️ + 1m 4s
 9 940 tests +12   9 869 ✅ +12  71 💤 ±0  0 ❌ ±0 
10 413 runs  +12  10 333 ✅ +12  80 💤 ±0  0 ❌ ±0 

Results for commit 3fa9e30. ± Comparison against base commit d63534c.

♻️ This comment has been updated with latest results.

Comment thread flow-server/src/main/java/com/vaadin/flow/signals/shared/SharedListSignal.java Outdated
Artur- added 2 commits March 27, 2026 14:58
Replace List<InsertOperation> return type with a new BulkInsertOperation
that provides a single result future for the entire batch and a list of
inserted signal instances. This is more convenient for callers and
enables potential future optimization with a single batch insert command.

Also removes redundant tests that only differ in position parameter since
all methods delegate to insertAllAt, and adds a test for invalid
position handling.
@github-actions github-actions bot added +0.1.0 and removed +0.0.1 labels Mar 27, 2026
@Artur- Artur- requested a review from Legioth March 30, 2026 11:20
@sonarqubecloud
Copy link
Copy Markdown

BulkInsertOperation<SharedValueSignal<String>> op = signal
.insertAllAt(List.of("a", "b"), ListPosition.after(child));

assertFailure(op);
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Could also verify that the content of the signal didn't unexpectedly change since the failure op does technically not guarantee that nothing has changed.

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

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants