fix(feed): an override yields only to a refetch that set out after its write was answered
Send order let a refetch read before an unanswered mark committed and drop it. A reset's position 0 is written again after a refetch that set out before the server took the reset. The player-session refetch also waits for the player's closing checkpoint, which the player now tracks (progressFlushes); refetched first, the list put the older position back.
This commit is contained in:
@@ -25,6 +25,19 @@ const isItemList = (v: unknown): v is ItemList =>
|
||||
* read: the endpoint clears trivially-early and near-finished checkpoints to 0, and mirroring our
|
||||
* own reading would re-introduce that disagreement on the client.
|
||||
*/
|
||||
// The player's closing flushes still on their way: its last checkpoint and the patch above. A list
|
||||
// refetched before one lands read the older checkpoint and, landing after the patch, put it back.
|
||||
const flushes = new Set<Promise<unknown>>();
|
||||
|
||||
/** Track a closing flush until it settles (`progressFlushes` hands out the ones still running). */
|
||||
export function trackProgressFlush(flush: Promise<unknown>): void {
|
||||
flushes.add(flush);
|
||||
const settled = () => void flushes.delete(flush);
|
||||
flush.then(settled, settled);
|
||||
}
|
||||
|
||||
export const progressFlushes = (): Promise<unknown>[] => [...flushes];
|
||||
|
||||
export function patchCachedProgress(qc: QueryClient, positions: Map<string, number>): void {
|
||||
if (positions.size === 0) return;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user