-**How `QueuedOnyxUpdates` works.** It is a module-level **in-memory** buffer. `queueOnyxUpdates` appends and resolves immediately; `flushQueue` snapshots-and-clears (to avoid races) then applies via `Onyx.update`. The WRITE-vs-READ routing decision lives **upstream** in `OnyxUpdates.applyHTTPSOnyxUpdates`: WRITE-type responses (`onyxData`, then `successData`/`failureData`/`finallyData`) route through `queueOnyxUpdates`; READ-type responses apply via `Onyx.update` immediately. When not signed in, `flushQueue` filters the snapshot to a 14-key preserved allowlist (`SESSION`, `NETWORK`, `IS_LOADING_APP`, `HAS_LOADED_APP`, `CREDENTIALS`, `ACCOUNT`, `MODAL`, `PRESERVED_USER_SESSION`, theme/locale/try-new-dot NVPs, and RAM-only loading flags); the filter is skipped entirely under `CONFIG.IS_TEST_ENV`. The pause early-return lives in `SequentialQueue.flushOnyxUpdatesQueue` (returns early when `isQueuePaused`). It is invoked at the end of a full drain — and from two other entry points: `flush()`'s all-empty guard counts a non-empty buffer as pending work (a flush with zero requests proceeds purely to drain the buffer), and `unpause()` calls it directly when the queue is already empty.
0 commit comments