Skip to content

Conversation

@Artur-
Copy link
Member

@Artur- Artur- commented Feb 10, 2026

Change bindValue(WritableSignal) to bindValue(Signal, SerializableConsumer) so that two-way bindings require an explicit write-back callback. This forces developers to acknowledge when user input is received, providing an additional layer of safety.

The first parameter is a read-only Signal for the signal-to-component direction. The second parameter is the callback for propagating value changes back to the signal. After invoking the callback, the signal is re-consulted via peek() and if the value differs, the component reverts to the signal's value. A null callback creates a read-only binding that throws on setValue while attached.

…ameter

Change bindValue(WritableSignal<V>) to bindValue(Signal<V>,
SerializableConsumer<V>) so that two-way bindings require an explicit
write-back callback. This forces developers to acknowledge when user
input is received, providing an additional layer of safety.

The first parameter is a read-only Signal for the signal-to-component
direction. The second parameter is the callback for propagating value
changes back to the signal. After invoking the callback, the signal is
re-consulted via peek() and if the value differs, the component reverts
to the signal's value. A null callback creates a read-only binding that
throws on setValue while attached.
@github-actions
Copy link

github-actions bot commented Feb 10, 2026

Test Results

 1 355 files  ± 0  1 355 suites  ±0   1h 16m 43s ⏱️ -57s
 9 603 tests + 7  9 535 ✅ + 7  68 💤 ±0  0 ❌ ±0 
10 067 runs  +10  9 991 ✅ +10  76 💤 ±0  0 ❌ ±0 

Results for commit 9fddfd5. ± Comparison against base commit 5dc7790.

♻️ This comment has been updated with latest results.

throw new BindingActiveException();
}

this.readSignal = valueSignal;
Copy link
Member

Choose a reason for hiding this comment

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

readSignal is not needed here as it's already stored in SignalBindingFeature. writeCallback should be stored in SignalBindingFeature instead.

Copy link
Member Author

Choose a reason for hiding this comment

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

Updated

SignalBindingFeature.VALUE, newValue);
}
});
if (!valueSetFromSignal && readSignal != null
Copy link
Member

Choose a reason for hiding this comment

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

Probably better if old code is just replaced here so that this new logic is executed inside if (component.isAttached()) { ... } block. Reading signal and consumer from the SignalBindingFeature feature.

Copy link
Member Author

Choose a reason for hiding this comment

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

Updated

…ractFieldSupport

Move the readSignal and writeCallback fields out of AbstractFieldSupport
and into SignalBindingFeature where the signal is already stored. The
setValue write-back logic now reads both the signal and callback from the
feature using the existing getFeatureIfInitialized pattern, keeping state
centralized in one place.
@sonarqubecloud
Copy link

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