optimistic updates with onMutate seem to be delayed by a frame?
we're seeing that sometimes, ~20% of the time, doing an optimistic update with onMutate is not propagating until a frame later, resulting in a flicker.
4 Replies
unwilling-turquoise•18h ago
Can you create an issue with a reproduction?
extended-salmonOP•18h ago
i will try. i think the fundamental issue is that the data signal is set in an async manner, rather than normal signal behavior which is sychronous-ish
extended-salmonOP•16h ago
ok here's a basic repro: https://stackblitz.com/edit/stackblitz-starters-hn17w1mv?file=src%2Fmain.ts,src%2Findex.html
StackBlitz
optimistic update flicker - StackBlitz
An angular-cli project based on @angular/animations, @angular/common, @angular/compiler, @angular/core, @angular/forms, @angular/platform-browser, @angular/platform-browser-dynamic, @angular/router, core-js, rxjs, tslib and zone.js
extended-salmonOP•15h ago
it's a fairly subtle issue, that repro's about 20% of the time (because it has to do with js message queue timing, i think)
but, if you edit the "whatever" to just '1' or whatever, you'll see the "whatever" show up for 1 frame
maybe i should use notifyManager.batchCalls myself for the second update
if i remove "notifyManager.batchCalls" in createBaseQuery, line 113, it fixes it