mirror of
https://github.com/mauriceboe/TREK.git
synced 2026-10-19 13:36:48 +00:00
df2768d30e
flush() returned at once when this tab already had a flush going, and that includes one still waiting for another tab's Web Lock. The socket's reconnect hook chains a refetch onto flush(), so a reconnect landing in that window rehydrated the trip while a replay was still on its way, the race the lock wait was meant to close. sendSoon and the online, periodic and visibility triggers make such an overlap common. flush() now keeps the running flush as a promise. A second call still asks it for one more pass and then gets that same promise back, so it resolves only once every pass, including the one it asked for, is done. The pass itself moves to _flushPass, and the repeat runs as a loop instead of a nested flush() call. The client CLAUDE.md sync bullet now says so, and loses its dash.