diff --git a/flow-client/src/main/java/com/vaadin/client/communication/MessageHandler.java b/flow-client/src/main/java/com/vaadin/client/communication/MessageHandler.java index 1cc3d4e3bc0..be0e0491102 100644 --- a/flow-client/src/main/java/com/vaadin/client/communication/MessageHandler.java +++ b/flow-client/src/main/java/com/vaadin/client/communication/MessageHandler.java @@ -378,10 +378,14 @@ assert getServerId(valueMap) == -1 if (json.hasKey(JsonConstants.UIDL_KEY_EXECUTE)) { // Invoke JS only after all tree changes have been - // propagated + // propagated and after post flush listeners added during + // message processing (so add one more post flush listener which + // is called after all added post listeners). Reactive.addPostFlushListener( - () -> registry.getExecuteJavaScriptProcessor().execute( - json.getArray(JsonConstants.UIDL_KEY_EXECUTE))); + () -> Reactive.addPostFlushListener(() -> registry + .getExecuteJavaScriptProcessor() + .execute(json.getArray( + JsonConstants.UIDL_KEY_EXECUTE)))); } Console.log("handleUIDLMessage: "