-
Notifications
You must be signed in to change notification settings - Fork 193
Description
Description of the bug
EffectContext.isBackgroundChange returns false for changes that are triggered by another user.
Expected behavior
Expected that changes from another user would be marked as background changes.
Minimal reproducible example
@Route
public class MainView extends VerticalLayout {
private static final SharedValueSignal<Boolean> signal = new SharedValueSignal<>(true);
public MainView() {
Span span = new Span();
span.bindText(() -> signal.get().toString()).onChange(context -> {
System.out.println("Background change: " + context.isBackgroundChange());
});
add(span);
add(new Button("Toggle from UI",click -> {
signal.update(x -> !x);
}));
add(new Button("Toggle from background thread",click -> {
Thread.startVirtualThread(() -> signal.update(x -> !x));
}));
}
}- Open the same UI in two separate browsers so that they use separate sessions
- Click the "Toggle from UI" button
- Notice that
Background change: falseis printed twice. Expected to get one case withtrueand another withfalse.
Note that the "Toggle from background thread" button works as expected - changes triggered in that way are reported as background changes for both users.
Versions
- Vaadin / Flow version: Vaadin 25.1.0-rc2
Reactions are currently unavailable
Metadata
Metadata
Assignees
Type
Projects
Status
🔖 Normal Priority (P2)
Status
🔎Iteration reviews