Skip to content

Multiple effect invocations if reading the same signal multiple times #23974

@Legioth

Description

@Legioth

Description of the bug

A component effect that reads the same signal multiple times is invoked multiple times when that signal is changed.

Expected behavior

The effect should be run only once for a single signal value change.

Minimal reproducible example

ValueSignal<String> signal = new ValueSignal<>("Initial");

Signal.effect(this, () -> {
    Notification.show(signal.get());
    signal.get();
    signal.get();
});

add(new Button("Update", click -> {
    signal.update(value -> value + " update ");
}));

Every time the button is clicked, three notifications are shown whereas only one notification is expected.

Versions

  • Vaadin / Flow version: 25.1.0-rc2

Metadata

Metadata

Assignees

No one assigned

    Type

    Projects

    Status

    🔖 High Priority (P1)

    Status

    🔎Iteration reviews

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions