-
Notifications
You must be signed in to change notification settings - Fork 1.8k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Batch store updates to once per event
Summary: When using features such as incremental delivery and data-driven dependencies ("3D"), Relay currently may make multiple "commits" to the store in a given tick of the JS event loop. Each of these commits - publish() + notify() - notifies subscribed UI components of any changes. However, given that we also configure Relay to use React's batching API to only notify components once, it's inefficient to make multiple commits to the store - checking subscriptions each time - rather than batching updates into a single commit. Specifically, when RelayModernQueryExecutor receives new data from the network it processes the top-level results first and commits, then processes "followups" (3D payloads) and commits them, then processes incremental payloads and commits them. Similarly, when a 3D payload resolves asynchronously its top-level data commits first, then any follow-ups are committed. This diff changes to ensure that within the scope of a given QueryExecutor instance, we batch all updates that can be batched within a given tick. Reviewed By: josephsavona Differential Revision: D27060940 fbshipit-source-id: dd9b3cfc456641bb6516f34f692da9ff3fe08181
- Loading branch information
1 parent
aef2144
commit 07d5f49
Showing
21 changed files
with
5,041 additions
and
3,340 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.