Debounces state synchronization to optimize UI rendering and network performance.
Purpose:
Group broadcasts belonging to the same UI rendering chain together. This prevents
race conditions, redundant network requests, and invalid Apollo Client state.
How it works:
Track In-Flight GraphQL Requests: Broadcasting while requests are in-flight
can corrupt Apollo Client state or trigger duplicate requests. We actively
track the count of active network requests.
Account for UI Rendering: UI components usually rerender immediately after
receiving a GraphQL response. Broadcasting during this render phase causes
similar state invalidation.
Debounce Post-Request: Once all in-flight requests drop to zero, we wait for
globalConfig.synchronizationDebounceTimeoutMs to ensure the UI has completely
finished its rendering cycle before safely executing the broadcast.
Debounces state synchronization to optimize UI rendering and network performance.
Purpose: Group broadcasts belonging to the same UI rendering chain together. This prevents race conditions, redundant network requests, and invalid Apollo Client state.
How it works: