This repository has been archived by the owner on Jan 1, 2025. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 1.2k
+82
−11
Conversation
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
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
Feb 23, 2022
This pull request was exported from Phabricator. Differential Revision: D34405832 |
drarmstr
added a commit
to drarmstr/Recoil
that referenced
this pull request
Feb 23, 2022
Summary: Pull Request resolved: facebookexperimental#1632 Automatically retains snapshots from `useRecoilCallback()` for the duration of async callbacks until the promise is resolved. This should help avoid potential user errors without needing to manually remember to `retain()` and release in a `finally` clause. Before: ``` const callback = useRecoilCallback(({snapshot}) => async () => { const release = snapshot.retain(); try { ... await ... use snapshot } finally { release(); } }); ``` After: ``` const callback = useRecoilCallback(({snapshot}) => async () => { ... await ... use snapshot }); ``` Manually retaining is still required if trying to persist the the Snapshot beyond the lifetime of the async callback or if it is used in async callbacks not dependent to a returned promise. Differential Revision: D34405832 fbshipit-source-id: cdd76b8d46488d79acc81a47f6cb257d6ed9d246
drarmstr
force-pushed
the
export-D34405832
branch
from
February 23, 2022 03:49
f20c97e
to
b025ec3
Compare
This pull request was exported from Phabricator. Differential Revision: D34405832 |
drarmstr
added a commit
to drarmstr/Recoil
that referenced
this pull request
Feb 23, 2022
Summary: Pull Request resolved: facebookexperimental#1632 Automatically retains snapshots from `useRecoilCallback()` for the duration of async callbacks until the promise is resolved. This should help avoid potential user errors without needing to manually remember to `retain()` and release in a `finally` clause. Before: ``` const callback = useRecoilCallback(({snapshot}) => async () => { const release = snapshot.retain(); try { ... await ... use snapshot } finally { release(); } }); ``` After: ``` const callback = useRecoilCallback(({snapshot}) => async () => { ... await ... use snapshot }); ``` Manually retaining is still required if trying to persist the the Snapshot beyond the lifetime of the async callback or if it is used in async callbacks not dependent to a returned promise. Differential Revision: D34405832 fbshipit-source-id: a82259e3912b72b3c08e95acb57c4a0d06d5ab95
This pull request was exported from Phabricator. Differential Revision: D34405832 |
drarmstr
force-pushed
the
export-D34405832
branch
from
February 23, 2022 23:53
b025ec3
to
0301e10
Compare
Summary: Pull Request resolved: facebookexperimental#1632 Automatically retains snapshots from `useRecoilCallback()` for the duration of async callbacks until the promise is resolved. This should help avoid potential user errors without needing to manually remember to `retain()` and release in a `finally` clause. Before: ``` const callback = useRecoilCallback(({snapshot}) => async () => { const release = snapshot.retain(); try { ... await ... use snapshot } finally { release(); } }); ``` After: ``` const callback = useRecoilCallback(({snapshot}) => async () => { ... await ... use snapshot }); ``` Manually retaining is still required if trying to persist the the Snapshot beyond the lifetime of the async callback or if it is used in async callbacks not dependent to a returned promise. Reviewed By: mondaychen Differential Revision: D34405832 fbshipit-source-id: eecd96f0b581c4eb69f1c347eda18a8a72ce508c
This pull request was exported from Phabricator. Differential Revision: D34405832 |
drarmstr
force-pushed
the
export-D34405832
branch
from
March 17, 2022 20:30
0301e10
to
6db3e15
Compare
drarmstr
added a commit
to drarmstr/Recoil
that referenced
this pull request
Mar 17, 2022
Summary: Pull Request resolved: facebookexperimental#1632 Automatically retains snapshots from `useRecoilCallback()` for the duration of async callbacks until the promise is resolved. This should help avoid potential user errors without needing to manually remember to `retain()` and release in a `finally` clause. Before: ``` const callback = useRecoilCallback(({snapshot}) => async () => { const release = snapshot.retain(); try { ... await ... use snapshot } finally { release(); } }); ``` After: ``` const callback = useRecoilCallback(({snapshot}) => async () => { ... await ... use snapshot }); ``` Manually retaining is still required if trying to persist the the Snapshot beyond the lifetime of the async callback or if it is used in async callbacks not dependent to a returned promise. Differential Revision: https://www.internalfb.com/diff/D34405832?entry_point=27 fbshipit-source-id: 36ec7585ec95ab6165e5782a126936f3c3e78c66
drarmstr
added a commit
to drarmstr/Recoil
that referenced
this pull request
Mar 17, 2022
Summary: Pull Request resolved: facebookexperimental#1632 Automatically retains snapshots from `useRecoilCallback()` for the duration of async callbacks until the promise is resolved. This should help avoid potential user errors without needing to manually remember to `retain()` and release in a `finally` clause. Before: ``` const callback = useRecoilCallback(({snapshot}) => async () => { const release = snapshot.retain(); try { ... await ... use snapshot } finally { release(); } }); ``` After: ``` const callback = useRecoilCallback(({snapshot}) => async () => { ... await ... use snapshot }); ``` Manually retaining is still required if trying to persist the the Snapshot beyond the lifetime of the async callback or if it is used in async callbacks not dependent to a returned promise. Differential Revision: https://www.internalfb.com/diff/D34405832?entry_point=27 fbshipit-source-id: da076434c923dde6fc31c1920c6260bdefe19986
drarmstr
added a commit
to drarmstr/Recoil
that referenced
this pull request
Mar 17, 2022
Summary: Pull Request resolved: facebookexperimental#1632 Automatically retains snapshots from `useRecoilCallback()` for the duration of async callbacks until the promise is resolved. This should help avoid potential user errors without needing to manually remember to `retain()` and release in a `finally` clause. Before: ``` const callback = useRecoilCallback(({snapshot}) => async () => { const release = snapshot.retain(); try { ... await ... use snapshot } finally { release(); } }); ``` After: ``` const callback = useRecoilCallback(({snapshot}) => async () => { ... await ... use snapshot }); ``` Manually retaining is still required if trying to persist the the Snapshot beyond the lifetime of the async callback or if it is used in async callbacks not dependent to a returned promise. Differential Revision: https://www.internalfb.com/diff/D34405832?entry_point=27 fbshipit-source-id: 50658d90b88a3da10004356c2870cf812164a29c
drarmstr
added a commit
to drarmstr/Recoil
that referenced
this pull request
Mar 17, 2022
Summary: Pull Request resolved: facebookexperimental#1632 Automatically retains snapshots from `useRecoilCallback()` for the duration of async callbacks until the promise is resolved. This should help avoid potential user errors without needing to manually remember to `retain()` and release in a `finally` clause. Before: ``` const callback = useRecoilCallback(({snapshot}) => async () => { const release = snapshot.retain(); try { ... await ... use snapshot } finally { release(); } }); ``` After: ``` const callback = useRecoilCallback(({snapshot}) => async () => { ... await ... use snapshot }); ``` Manually retaining is still required if trying to persist the the Snapshot beyond the lifetime of the async callback or if it is used in async callbacks not dependent to a returned promise. Differential Revision: https://www.internalfb.com/diff/D34405832?entry_point=27 fbshipit-source-id: 7cb310815c669a62623f1819c4bf8841f9c5002a
drarmstr
added a commit
to drarmstr/Recoil
that referenced
this pull request
Mar 17, 2022
Summary: Pull Request resolved: facebookexperimental#1632 Automatically retains snapshots from `useRecoilCallback()` for the duration of async callbacks until the promise is resolved. This should help avoid potential user errors without needing to manually remember to `retain()` and release in a `finally` clause. Before: ``` const callback = useRecoilCallback(({snapshot}) => async () => { const release = snapshot.retain(); try { ... await ... use snapshot } finally { release(); } }); ``` After: ``` const callback = useRecoilCallback(({snapshot}) => async () => { ... await ... use snapshot }); ``` Manually retaining is still required if trying to persist the the Snapshot beyond the lifetime of the async callback or if it is used in async callbacks not dependent to a returned promise. Differential Revision: https://www.internalfb.com/diff/D34405832?entry_point=27 fbshipit-source-id: 7f88517f6d46568ef9cb8cb8811c1742939d5ff2
drarmstr
added a commit
to drarmstr/Recoil
that referenced
this pull request
Mar 18, 2022
Summary: Pull Request resolved: facebookexperimental#1632 Automatically retains snapshots from `useRecoilCallback()` for the duration of async callbacks until the promise is resolved. This should help avoid potential user errors without needing to manually remember to `retain()` and release in a `finally` clause. Before: ``` const callback = useRecoilCallback(({snapshot}) => async () => { const release = snapshot.retain(); try { ... await ... use snapshot } finally { release(); } }); ``` After: ``` const callback = useRecoilCallback(({snapshot}) => async () => { ... await ... use snapshot }); ``` Manually retaining is still required if trying to persist the the Snapshot beyond the lifetime of the async callback or if it is used in async callbacks not dependent to a returned promise. Differential Revision: https://www.internalfb.com/diff/D34405832?entry_point=27 fbshipit-source-id: 45b7fd1dbea20f57d7c437061365e3846e0b8651
AlexGuz23
pushed a commit
to AlexGuz23/Recoil
that referenced
this pull request
Nov 3, 2022
Summary: Pull Request resolved: facebookexperimental/Recoil#1632 Automatically retains snapshots from `useRecoilCallback()` for the duration of async callbacks until the promise is resolved. This should help avoid potential user errors without needing to manually remember to `retain()` and release in a `finally` clause. Before: ``` const callback = useRecoilCallback(({snapshot}) => async () => { const release = snapshot.retain(); try { ... await ... use snapshot } finally { release(); } }); ``` After: ``` const callback = useRecoilCallback(({snapshot}) => async () => { ... await ... use snapshot }); ``` Manually retaining is still required if trying to persist the the Snapshot beyond the lifetime of the async callback or if it is used in async callbacks not dependent to a returned promise. Reviewed By: mondaychen Differential Revision: D34405832 fbshipit-source-id: daddc09a037c3f91b9790464adae7981191a16dd
snipershooter0701
pushed a commit
to snipershooter0701/Recoil
that referenced
this pull request
Mar 5, 2023
Summary: Pull Request resolved: facebookexperimental/Recoil#1632 Automatically retains snapshots from `useRecoilCallback()` for the duration of async callbacks until the promise is resolved. This should help avoid potential user errors without needing to manually remember to `retain()` and release in a `finally` clause. Before: ``` const callback = useRecoilCallback(({snapshot}) => async () => { const release = snapshot.retain(); try { ... await ... use snapshot } finally { release(); } }); ``` After: ``` const callback = useRecoilCallback(({snapshot}) => async () => { ... await ... use snapshot }); ``` Manually retaining is still required if trying to persist the the Snapshot beyond the lifetime of the async callback or if it is used in async callbacks not dependent to a returned promise. Reviewed By: mondaychen Differential Revision: D34405832 fbshipit-source-id: daddc09a037c3f91b9790464adae7981191a16dd
eagle2722
added a commit
to eagle2722/Recoil
that referenced
this pull request
Sep 21, 2024
Summary: Pull Request resolved: facebookexperimental/Recoil#1632 Automatically retains snapshots from `useRecoilCallback()` for the duration of async callbacks until the promise is resolved. This should help avoid potential user errors without needing to manually remember to `retain()` and release in a `finally` clause. Before: ``` const callback = useRecoilCallback(({snapshot}) => async () => { const release = snapshot.retain(); try { ... await ... use snapshot } finally { release(); } }); ``` After: ``` const callback = useRecoilCallback(({snapshot}) => async () => { ... await ... use snapshot }); ``` Manually retaining is still required if trying to persist the the Snapshot beyond the lifetime of the async callback or if it is used in async callbacks not dependent to a returned promise. Reviewed By: mondaychen Differential Revision: D34405832 fbshipit-source-id: daddc09a037c3f91b9790464adae7981191a16dd
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.
enhancement
New feature or request
fb-exported
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Summary:
Automatically retains snapshots from
useRecoilCallback()
for the duration of async callbacks until the promise is resolved. This should help avoid potential user errors without needing to manually remember toretain()
and release in afinally
clause.Before:
After:
Manually retaining is still required if trying to persist the the Snapshot beyond the lifetime of the async callback or if it is used in async callbacks not dependent to a returned promise.
Differential Revision: D34405832