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

Test onSet() is called when atom initialized via snapshot #1519

Closed
wants to merge 3 commits into from

Conversation

drarmstr
Copy link
Contributor

Summary: Test that onSet() is called and setSelf() works when atoms are initialized first via Snapshot and then used from hooks in a <RecoilRoot>. This includes when initializing atoms via initializeState prop in <RecoilRoot> which uses a Snapshot. Also make sure the "current" value provided in the updater form of setSelf() reflects the current initialized value.

Differential Revision: D33372676

@facebook-github-bot facebook-github-bot added CLA Signed This label is managed by the Facebook bot. Authors need to sign the CLA before a PR can be reviewed. fb-exported labels Dec 30, 2021
@facebook-github-bot
Copy link
Contributor

This pull request was exported from Phabricator. Differential Revision: D33372676

drarmstr added a commit to drarmstr/Recoil that referenced this pull request Dec 31, 2021
…perimental#1519)

Summary:
Pull Request resolved: facebookexperimental#1519

Test that `onSet()` is called and `setSelf()` works when atoms are initialized first via Snapshot and then used from hooks in a `<RecoilRoot>`.  This includes when initializing atoms via `initializeState` prop in `<RecoilRoot>` which uses a Snapshot.  Also make sure the "current" value provided in the updater form of `setSelf()` reflects the current initialized value.

Differential Revision: https://www.internalfb.com/diff/D33372676?entry_point=27

fbshipit-source-id: fea08fe093bf8c59e91bb1bf62f70888c64f1bea
@drarmstr drarmstr self-assigned this Jan 4, 2022
@drarmstr drarmstr added the tests Everything related to tests label Jan 4, 2022
@facebook-github-bot
Copy link
Contributor

This pull request was exported from Phabricator. Differential Revision: D33372676

drarmstr added a commit to drarmstr/Recoil that referenced this pull request Jan 4, 2022
…perimental#1519)

Summary:
Pull Request resolved: facebookexperimental#1519

Test that `onSet()` is called and `setSelf()` works when atoms are initialized first via Snapshot and then used from hooks in a `<RecoilRoot>`.  This includes when initializing atoms via `initializeState` prop in `<RecoilRoot>` which uses a Snapshot.  Also make sure the "current" value provided in the updater form of `setSelf()` reflects the current initialized value.

Differential Revision: D33372676

fbshipit-source-id: f73f3efaa98436c28d13d4b16da515fdcdf0ab85
drarmstr added a commit to drarmstr/Recoil that referenced this pull request Jan 4, 2022
…perimental#1519)

Summary:
Pull Request resolved: facebookexperimental#1519

Test that `onSet()` is called and `setSelf()` works when atoms are initialized first via Snapshot and then used from hooks in a `<RecoilRoot>`.  This includes when initializing atoms via `initializeState` prop in `<RecoilRoot>` which uses a Snapshot.  Also make sure the "current" value provided in the updater form of `setSelf()` reflects the current initialized value.

Differential Revision: https://www.internalfb.com/diff/D33372676?entry_point=27

fbshipit-source-id: cfe11d8c8fa009e250789d6c11dd60b1b64d6cb8
@facebook-github-bot
Copy link
Contributor

This pull request was exported from Phabricator. Differential Revision: D33372676

drarmstr added a commit to drarmstr/Recoil that referenced this pull request Jan 4, 2022
…perimental#1519)

Summary:
Pull Request resolved: facebookexperimental#1519

Test that `onSet()` is called and `setSelf()` works when atoms are initialized first via Snapshot and then used from hooks in a `<RecoilRoot>`.  This includes when initializing atoms via `initializeState` prop in `<RecoilRoot>` which uses a Snapshot.  Also make sure the "current" value provided in the updater form of `setSelf()` reflects the current initialized value.

Differential Revision: D33372676

fbshipit-source-id: 8105e6183921492860929051acdfd82306e34032
drarmstr added a commit to drarmstr/Recoil that referenced this pull request Jan 4, 2022
…perimental#1519)

Summary:
Pull Request resolved: facebookexperimental#1519

Test that `onSet()` is called and `setSelf()` works when atoms are initialized first via Snapshot and then used from hooks in a `<RecoilRoot>`.  This includes when initializing atoms via `initializeState` prop in `<RecoilRoot>` which uses a Snapshot.  Also make sure the "current" value provided in the updater form of `setSelf()` reflects the current initialized value.

Differential Revision: D33372676

fbshipit-source-id: ceba00f2dccea256723ef4db76d558d7cdb88973
@facebook-github-bot
Copy link
Contributor

This pull request was exported from Phabricator. Differential Revision: D33372676

drarmstr added a commit to drarmstr/Recoil that referenced this pull request Jan 4, 2022
…perimental#1519)

Summary:
Pull Request resolved: facebookexperimental#1519

Test that `onSet()` is called and `setSelf()` works when atoms are initialized first via Snapshot and then used from hooks in a `<RecoilRoot>`.  This includes when initializing atoms via `initializeState` prop in `<RecoilRoot>` which uses a Snapshot.  Also make sure the "current" value provided in the updater form of `setSelf()` reflects the current initialized value.

Differential Revision: https://www.internalfb.com/diff/D33372676?entry_point=27

fbshipit-source-id: abf4785b50d5a52a4228fa793952fb1e1d3f1730
drarmstr added a commit to drarmstr/Recoil that referenced this pull request Jan 4, 2022
…perimental#1519)

Summary:
Pull Request resolved: facebookexperimental#1519

Test that `onSet()` is called and `setSelf()` works when atoms are initialized first via Snapshot and then used from hooks in a `<RecoilRoot>`.  This includes when initializing atoms via `initializeState` prop in `<RecoilRoot>` which uses a Snapshot.  Also make sure the "current" value provided in the updater form of `setSelf()` reflects the current initialized value.

Differential Revision: D33372676

fbshipit-source-id: 78cec7b2a759d94c77a9059aa2ad426b6e3a0c49
@facebook-github-bot
Copy link
Contributor

This pull request was exported from Phabricator. Differential Revision: D33372676

1 similar comment
@facebook-github-bot
Copy link
Contributor

This pull request was exported from Phabricator. Differential Revision: D33372676

drarmstr added a commit to drarmstr/Recoil that referenced this pull request Jan 4, 2022
…perimental#1519)

Summary:
Pull Request resolved: facebookexperimental#1519

Test that `onSet()` is called and `setSelf()` works when atoms are initialized first via Snapshot and then used from hooks in a `<RecoilRoot>`.  This includes when initializing atoms via `initializeState` prop in `<RecoilRoot>` which uses a Snapshot.  Also make sure the "current" value provided in the updater form of `setSelf()` reflects the current initialized value.

Differential Revision: D33372676

fbshipit-source-id: 7927859ef330bccf9723c2e96b8b551149b93bad
drarmstr added a commit to drarmstr/Recoil that referenced this pull request Jan 5, 2022
…perimental#1519)

Summary:
Pull Request resolved: facebookexperimental#1519

Test that `onSet()` is called and `setSelf()` works when atoms are initialized first via Snapshot and then used from hooks in a `<RecoilRoot>`.  This includes when initializing atoms via `initializeState` prop in `<RecoilRoot>` which uses a Snapshot.  Also make sure the "current" value provided in the updater form of `setSelf()` reflects the current initialized value.

Reviewed By: habond

Differential Revision: D33372676

fbshipit-source-id: 069d89bbfe0d0c1b1a3a31508a5b7e3f1e2de278
@facebook-github-bot
Copy link
Contributor

This pull request was exported from Phabricator. Differential Revision: D33372676

drarmstr added a commit to drarmstr/Recoil that referenced this pull request Jan 5, 2022
…perimental#1519)

Summary:
Pull Request resolved: facebookexperimental#1519

Test that `onSet()` is called and `setSelf()` works when atoms are initialized first via Snapshot and then used from hooks in a `<RecoilRoot>`.  This includes when initializing atoms via `initializeState` prop in `<RecoilRoot>` which uses a Snapshot.  Also make sure the "current" value provided in the updater form of `setSelf()` reflects the current initialized value.

Reviewed By: habond

Differential Revision: D33372676

fbshipit-source-id: 518284249a5aa92243841805f50e6c14dc10dd58
@facebook-github-bot
Copy link
Contributor

This pull request was exported from Phabricator. Differential Revision: D33372676

drarmstr added a commit to drarmstr/Recoil that referenced this pull request Jan 5, 2022
…perimental#1519)

Summary:
Pull Request resolved: facebookexperimental#1519

Test that `onSet()` is called and `setSelf()` works when atoms are initialized first via Snapshot and then used from hooks in a `<RecoilRoot>`.  This includes when initializing atoms via `initializeState` prop in `<RecoilRoot>` which uses a Snapshot.  Also make sure the "current" value provided in the updater form of `setSelf()` reflects the current initialized value.

Differential Revision: https://www.internalfb.com/diff/D33372676?entry_point=27

fbshipit-source-id: bd1b3c45a89b9f05c83c0203d24f23f7128bb799
drarmstr added a commit to drarmstr/Recoil that referenced this pull request Jan 5, 2022
…perimental#1519)

Summary:
Pull Request resolved: facebookexperimental#1519

Test that `onSet()` is called and `setSelf()` works when atoms are initialized first via Snapshot and then used from hooks in a `<RecoilRoot>`.  This includes when initializing atoms via `initializeState` prop in `<RecoilRoot>` which uses a Snapshot.  Also make sure the "current" value provided in the updater form of `setSelf()` reflects the current initialized value.

Reviewed By: habond

Differential Revision: D33372676

fbshipit-source-id: 372ebbefbe0174c914bb1ead1cc4202b84b78d5a
@facebook-github-bot
Copy link
Contributor

This pull request was exported from Phabricator. Differential Revision: D33372676

drarmstr added a commit to drarmstr/Recoil that referenced this pull request Jan 5, 2022
…perimental#1519)

Summary:
Pull Request resolved: facebookexperimental#1519

Test that `onSet()` is called and `setSelf()` works when atoms are initialized first via Snapshot and then used from hooks in a `<RecoilRoot>`.  This includes when initializing atoms via `initializeState` prop in `<RecoilRoot>` which uses a Snapshot.  Also make sure the "current" value provided in the updater form of `setSelf()` reflects the current initialized value.

Differential Revision: https://www.internalfb.com/diff/D33372676?entry_point=27

fbshipit-source-id: 829b0dc4c2c4ad1ffbb7f4435756fb6d0e87a0b0
…mental#1511)

Summary:
Pull Request resolved: facebookexperimental#1511

When an atom is used with a snapshot that has not already seen it, then it needs to initialize and run the atom effects.  Make sure those atom effects are cleaned up when that snapshot is released.

Also fix selector cleanup so it is consistent with new semantics for `knownAtoms`/`knownSelectors` retaining cleaned up keys and avoid remvoing the pending execution info.  Otherwise as some tools used snapshots (such as from recoil callbacks) that had initialized the selector, then when that snapshot was released it could remove the execution info for a pending async selector and cause it never to resolve.  Add a unit test to cover this case.

Differential Revision: https://www.internalfb.com/diff/D33270037?entry_point=27

fbshipit-source-id: d16888fd712fdfb7939ac678203657788e01105d
Summary:
Improved testing of Recoil Bridges using `useRecoilBridgeAcrossReactRoots()`:
* Test with `<StrictMode>` and `createRoot()` concurrent mode.
  * There appears to be an issue with `createRoot()` and `useMutableSource()` with bridging.  Add a dynamic warning to upgrade to `recoil_sync_external_store` mode.  This does not affect the open-source release.
* Confirm that the `StoreID` from `useRecoilStoreID()` matches across the bridge.

Differential Revision: https://www.internalfb.com/diff/D33284863?entry_point=27

fbshipit-source-id: 4da3fb056fee3aeaf1bc177980ad28a880cab1b1
…perimental#1519)

Summary:
Pull Request resolved: facebookexperimental#1519

Test that `onSet()` is called and `setSelf()` works when atoms are initialized first via Snapshot and then used from hooks in a `<RecoilRoot>`.  This includes when initializing atoms via `initializeState` prop in `<RecoilRoot>` which uses a Snapshot.  Also make sure the "current" value provided in the updater form of `setSelf()` reflects the current initialized value.

Reviewed By: habond

Differential Revision: D33372676

fbshipit-source-id: e20857be534202b401ce5e122ce56dffea362c87
drarmstr added a commit to drarmstr/Recoil that referenced this pull request Jan 5, 2022
…perimental#1519)

Summary:
Pull Request resolved: facebookexperimental#1519

Test that `onSet()` is called and `setSelf()` works when atoms are initialized first via Snapshot and then used from hooks in a `<RecoilRoot>`.  This includes when initializing atoms via `initializeState` prop in `<RecoilRoot>` which uses a Snapshot.  Also make sure the "current" value provided in the updater form of `setSelf()` reflects the current initialized value.

Differential Revision: https://www.internalfb.com/diff/D33372676?entry_point=27

fbshipit-source-id: d7d1c8a8af2a24f81b9a2bebc1d5bec116c1c0c7
@facebook-github-bot
Copy link
Contributor

This pull request was exported from Phabricator. Differential Revision: D33372676

drarmstr added a commit to drarmstr/Recoil that referenced this pull request Jan 6, 2022
…perimental#1519)

Summary:
Pull Request resolved: facebookexperimental#1519

Test that `onSet()` is called and `setSelf()` works when atoms are initialized first via Snapshot and then used from hooks in a `<RecoilRoot>`.  This includes when initializing atoms via `initializeState` prop in `<RecoilRoot>` which uses a Snapshot.  Also make sure the "current" value provided in the updater form of `setSelf()` reflects the current initialized value.

Differential Revision: https://www.internalfb.com/diff/D33372676?entry_point=27

fbshipit-source-id: 0aaa7ec152d266a6a29028729197fdad58d24ea6
@drarmstr drarmstr deleted the export-D33372676 branch January 8, 2022 09:47
AlexGuz23 pushed a commit to AlexGuz23/Recoil that referenced this pull request Nov 3, 2022
Summary:
Pull Request resolved: facebookexperimental/Recoil#1519

Test that `onSet()` is called and `setSelf()` works when atoms are initialized first via Snapshot and then used from hooks in a `<RecoilRoot>`.  This includes when initializing atoms via `initializeState` prop in `<RecoilRoot>` which uses a Snapshot.  Also make sure the "current" value provided in the updater form of `setSelf()` reflects the current initialized value.

Reviewed By: habond

Differential Revision: D33372676

fbshipit-source-id: 7de0b837847e43a6ef1cc5d383f948053850de09
snipershooter0701 pushed a commit to snipershooter0701/Recoil that referenced this pull request Mar 5, 2023
Summary:
Pull Request resolved: facebookexperimental/Recoil#1519

Test that `onSet()` is called and `setSelf()` works when atoms are initialized first via Snapshot and then used from hooks in a `<RecoilRoot>`.  This includes when initializing atoms via `initializeState` prop in `<RecoilRoot>` which uses a Snapshot.  Also make sure the "current" value provided in the updater form of `setSelf()` reflects the current initialized value.

Reviewed By: habond

Differential Revision: D33372676

fbshipit-source-id: 7de0b837847e43a6ef1cc5d383f948053850de09
eagle2722 added a commit to eagle2722/Recoil that referenced this pull request Sep 21, 2024
Summary:
Pull Request resolved: facebookexperimental/Recoil#1519

Test that `onSet()` is called and `setSelf()` works when atoms are initialized first via Snapshot and then used from hooks in a `<RecoilRoot>`.  This includes when initializing atoms via `initializeState` prop in `<RecoilRoot>` which uses a Snapshot.  Also make sure the "current" value provided in the updater form of `setSelf()` reflects the current initialized value.

Reviewed By: habond

Differential Revision: D33372676

fbshipit-source-id: 7de0b837847e43a6ef1cc5d383f948053850de09
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
CLA Signed This label is managed by the Facebook bot. Authors need to sign the CLA before a PR can be reviewed. fb-exported tests Everything related to tests
Projects
None yet
Development

Successfully merging this pull request may close these issues.

onSet() handler in effect not triggered when atom initialized via RecoilRoot initializeState or snapshot
2 participants