Skip to content

docs: CRUD editor example with Binder and signal-based UI state management#5313

Open
platosha wants to merge 3 commits intomainfrom
signals-binder
Open

docs: CRUD editor example with Binder and signal-based UI state management#5313
platosha wants to merge 3 commits intomainfrom
signals-binder

Conversation

@platosha
Copy link
Copy Markdown
Contributor

@platosha platosha commented Mar 4, 2026

Fixes #5075

  • Introduce CrudEditorExample demonstrating reactive CRUD functionality using signals, binder integration, and effects
  • Add a guide article to UI state examples documentation

…ement

Fixes #5075

- Introduce `CrudEditorExample` demonstrating reactive CRUD functionality using signals, binder integration, and effects
- Add a guide article to UI state examples documentation
@mshabarov mshabarov requested a review from tltv March 9, 2026 12:54
We use [methodname]`Binder::readBean(bean)` to update the form data using
a signal. This is the preferred approach.

Avoid using [methodname]`Binder::setBean(beanInstance)` with signals, as this
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.

Maybe this could be reformed in such way that users should be aware of setBean meaning unbuffered binder, and changes to the bean are directly reflected to the signal value. This may be wanted in some use case, but usage of buffered binder with readBean (or readRecord for some other use case) is used for the explained reason in this example and it's recommended in this case when form fields are bound to signals.

@peholmst peholmst added the target/v25.1 Automatically cherry-pick to the v25.1 branch label Mar 25, 2026
Comment on lines +85 to +94
We use [methodname]`Binder::readBean(bean)` to update the form data using
a signal. This is the preferred approach.

Avoid using [methodname]`Binder::setBean(beanInstance)` with signals, as this
enables the binder to change the bean properties directly using setter methods.
Such changes are not detected by signals.

To update the signal with the changes from the binder,
use [methodname]`Binder::writeBean(bean)` combined with the `signal.set(bean)`,
see the example below.
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.

Suggested change
We use [methodname]`Binder::readBean(bean)` to update the form data using
a signal. This is the preferred approach.
Avoid using [methodname]`Binder::setBean(beanInstance)` with signals, as this
enables the binder to change the bean properties directly using setter methods.
Such changes are not detected by signals.
To update the signal with the changes from the binder,
use [methodname]`Binder::writeBean(bean)` combined with the `signal.set(bean)`,
see the example below.
This example uses [methodname]`Binder::readBean(bean)`, which copies the bean's
property values into the form fields. Changes in the fields are held by the
binder and only written back when you explicitly call
[methodname]`Binder::writeBean(bean)`. This is the recommended approach when
form fields bind to signals, because it gives you full control over when the
signal value is updated (see the save example below).
Using [methodname]`Binder::setBean(bean)` instead binds the form fields
directly to the bean instance. Every field edit is written to the bean
immediately via its setter methods. Those direct mutations are not detected by
signals, so the signal value can change without triggering reactive updates.
This may suit scenarios where immediate write-through is desired, but in most
cases [methodname]`readBean` combined with [methodname]`writeBean` is
preferred.

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

Labels

target/v25.1 Automatically cherry-pick to the v25.1 branch

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Signal with the bean/record to edit

5 participants