No. Because actually it works under some conditions. When we initialize our view we are also doing the
private void init() {
this.getModel().setProduct("Product A");
...
}
And the value is set on the model and also on the real html component and this is triggering the observer correctly.
But when we do it to react on a event like here for example:
this.emitterProcessor.filter(event -> event instanceof ProductChangedEvent).subscribe(event -> {
log.info("new event");
this.getUI().ifPresent(ui -> ui.access(() -> {
log.info("access UI");
this.getModel().setProduct("Product C");
log.info("new product: " + this.getModel().getProduct();
}));
});
The output is:
new event
access UI
new product: Product C
The value is set on our model but not on our actual html component (we checked that by adding a simple clicklistener which just prints out our value set to the console), so the observer is not firing.