-
-
Notifications
You must be signed in to change notification settings - Fork 5
Description
I got problems with table not redrawing after switching from GWT RPC to Domino REST.
To make migration easy I use a adapter. I had to add scheduleDeferred to it:
s.get().onSuccess(response -> {
callback.onSuccess(response);
Scheduler.get().scheduleDeferred(() -> {
});
}).onFailed(errorResponse -> {
callback.onFailure(buildException(errorResponse));
Scheduler.get().scheduleDeferred(() -> {
});
}).send();
Why Scheduler.scheduleDeferred() is Needed:
GWT applications run in a single-threaded JavaScript event loop. Any UI updates must happen within this event loop to ensure consistent rendering and correct UI behavior.
When you're using:
GWT RPC:
Callbacks are automatically invoked within GWT's event-loop scheduler, which means no manual handling is required.
Domino REST or external JavaScript promises (Elemental2):
Callbacks execute in JavaScript's native promise event queue, outside the GWT event scheduler.
Thus, the GWT framework might not detect that a UI update is needed immediately, resulting in delayed UI redraws.
Using a empty scheduleDeferred flushes the event loop and triggers scheduleFinally() of CellTable. This also prevents flickering.