Skip to content
This repository was archived by the owner on Jan 1, 2025. It is now read-only.

[recoil-sync] Support transactional updateItems() in RecoilSync #2017

Closed
luishdz1010 opened this issue Sep 20, 2022 · 1 comment
Closed

[recoil-sync] Support transactional updateItems() in RecoilSync #2017

luishdz1010 opened this issue Sep 20, 2022 · 1 comment
Labels
Component: recoil-sync Related to recoil-sync enhancement New feature or request help wanted Extra attention is needed

Comments

@luishdz1010
Copy link
Contributor

When syncing from an external store to recoil in the listen prop of RecoilSync, each call to updateItem(k, v) notifies components associated with each atom's key. However, since not all the state is synced yet (more synchronous updateItem() calls pending), some components will observe a "partially" synced state, which can cause errors.

In my case, this is making some components observe deleted state that would otherwise be consistent if all updates were applied before components get notified.

Using updateAllKnownItems might work, but in my case, the number of atoms is vast and updates are often, so this will do a lot of unnecessary work (assuming updateAllKnownItems has transaction semantics).

@drarmstr drarmstr added enhancement New feature or request help wanted Extra attention is needed Component: recoil-sync Related to recoil-sync labels Sep 23, 2022
@drarmstr
Copy link
Contributor

That should be straight-forward if someone want to submit a PR? Both updateItem() and updateAllKnownItems() are implemented in terms of updateItems() which just isn't exposed yet.

@drarmstr drarmstr changed the title Support transactional updateItem in RecoilSync [recoil-sync] Support transactional updateItem in RecoilSync Sep 23, 2022
@drarmstr drarmstr changed the title [recoil-sync] Support transactional updateItem in RecoilSync [recoil-sync] Support transactional updateItems() in RecoilSync Oct 4, 2022
snipershooter0701 pushed a commit to snipershooter0701/Recoil that referenced this issue Mar 5, 2023
Summary:
Fixes facebookexperimental/Recoil#2017

Pull Request resolved: facebookexperimental/Recoil#2035

Reviewed By: aaronabramov

Differential Revision: D40037596

Pulled By: drarmstr

fbshipit-source-id: 69a706e4e7bc6a47ef7a8cfc8657ded852e98b09
eagle2722 added a commit to eagle2722/Recoil that referenced this issue Sep 21, 2024
Summary:
Fixes facebookexperimental/Recoil#2017

Pull Request resolved: facebookexperimental/Recoil#2035

Reviewed By: aaronabramov

Differential Revision: D40037596

Pulled By: drarmstr

fbshipit-source-id: 69a706e4e7bc6a47ef7a8cfc8657ded852e98b09
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Component: recoil-sync Related to recoil-sync enhancement New feature or request help wanted Extra attention is needed
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants