Skip to content

feat: CallbackAction + SetSignalAction — trigger actions for server-side callbacks#24436

Merged
tltv merged 4 commits into
mainfrom
set-signal-action
May 27, 2026
Merged

feat: CallbackAction + SetSignalAction — trigger actions for server-side callbacks#24436
tltv merged 4 commits into
mainfrom
set-signal-action

Conversation

@Artur-
Copy link
Copy Markdown
Member

@Artur- Artur- commented May 25, 2026

CallbackAction forwards a value from a trigger's handler scope back to the server via a ReturnChannelRegistration, decodes it as T, and hands it to a SerializableConsumer on the UI thread. Use it to bridge any client-side trigger into arbitrary server-side state — log a value, fire a custom event, push to a queue, etc.

SetSignalAction is a thin named subclass for the common case of signal::set. Signal parameters are typed as ? super T so a wider signal can be paired with a narrower valueType.

…ide callbacks

CallbackAction<T> forwards a value from a trigger's handler scope back to
the server via a ReturnChannelRegistration, decodes it as T, and hands it
to a SerializableConsumer<T> on the UI thread. Use it to bridge any
client-side trigger into arbitrary server-side state — log a value, fire
a custom event, push to a queue, etc.

SetSignalAction is a thin named subclass for the common case of
`signal::set`, with overloads for ValueSignal (local) and
SharedValueSignal (shared). Signal parameters are typed as `? super T`
so a wider signal can be paired with a narrower valueType.
@Artur- Artur- force-pushed the set-signal-action branch from 14b9c5d to 471435a Compare May 25, 2026 13:56
@github-actions
Copy link
Copy Markdown

github-actions Bot commented May 25, 2026

Test Results

 1 424 files  +3   1 424 suites  +3   1h 21m 27s ⏱️ + 1m 41s
10 016 tests +6   9 948 ✅ +6  68 💤 ±0  0 ❌ ±0 
10 488 runs  +6  10 419 ✅ +6  69 💤 ±0  0 ❌ ±0 

Results for commit f2f1480. ± Comparison against base commit d9afcc4.

♻️ This comment has been updated with latest results.

Keep only the ValueSignal (local) constructor. Callers that want to
write to a SharedValueSignal can still do so via CallbackAction with
a method reference.
…ignal

Wires an Input's "input" event to a SetSignalAction that pushes the
field's value into a ValueSignal, with a Signal.effect mirroring the
value into a status Div. The IT types into the field and asserts the
status Div reflects each keystroke — exercising the full
browser → trigger → return channel → signal → effect → DOM round-trip.
@sonarqubecloud
Copy link
Copy Markdown

Copy link
Copy Markdown
Member

@tltv tltv left a comment

Choose a reason for hiding this comment

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

LGTM. There could be tests for other types too than just String, but if it just repeats already existing tests (it's mainly testing that Jackson does its job anyway) then not needed here. Can be added in other PRs too, if there are none yet for the triggers/actions context.

@tltv tltv added this pull request to the merge queue May 27, 2026
Merged via the queue into main with commit 0e2ffff May 27, 2026
34 checks passed
@tltv tltv deleted the set-signal-action branch May 27, 2026 12:32
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants