feat: CallbackAction + SetSignalAction — trigger actions for server-side callbacks#24436
Merged
Conversation
…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.
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.
|
tltv
approved these changes
May 27, 2026
Member
tltv
left a comment
There was a problem hiding this comment.
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.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.



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 Tso a wider signal can be paired with a narrower valueType.