New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Export isLoadable() #1312
Closed
Closed
Export isLoadable() #1312
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
Summary: Pull Request resolved: facebookexperimental#1263 Expose factory interface for creating `Loadable` objects. Note that `Loadable` is not a class due to limitations with Flow not supporting disjoint unions with class properties. Therefore, I don't think we can export `Loadable` as a type as well as an object containing static factories. So, use `Load` instead... :( Proposed interface examples: ``` const valueLoadable = RecoilLoadable.of('VALUE'); ``` ``` const pendingLoadable = RecoilLoadable.of(Promise.resolve('ASYNC VALUE')); ``` ``` const errorLoadable = RecoilLoadable.error(new Error('ERROR')); ``` D31040527 adds `RecoilLoadable.all()` Differential Revision: D31038573 fbshipit-source-id: 24d28d4435d3714549b7f30b77038a7f72754f0c
Summary: Use the new public Loadable factory interface in recoil-sync library Differential Revision: D31038775 fbshipit-source-id: 510039b50d4f5dd3ca64af937ad0f663ea606f84
Summary: Pull Request resolved: facebookexperimental#1264 Add a `Load.all()` factory for Loadables analogous to `Promise.all()`: ``` Load.all([ Load.of('abc'), Load.of(123) ]).contents ['abc', 123] ``` Also provide an object version in addition to an array version: ``` Load.all({ str: Load.of('abc'), num: Load.of(123) }).contents {str: abc, num: 123} ``` This also works nested: ``` Load.all([ Load.all([Load.of('a'), Load.of('b')]), Load.all([Load.of(1), Load.of(2)]), ]).contents [ ['a','b'], [1,2] ] ``` And it support async inputs: ``` Load.all([ Load.of(Promise.resolve('async')), Load.of('sync') ]).map(values => { values is ['async', 'sync'] }); ``` Note TypeScript should have the proper tuple and object mapping, but not sure how to enable that for Flow since the factory is nested in `Load` object... Differential Revision: https://www.internalfb.com/diff/D31040527?entry_point=27 fbshipit-source-id: 66fd83ade0a2c1db71efe3ee5a95be763c1e43df
Summary: Export `isLoadable()` as part of the `RecoilLoadable` interface for Loadables. Reviewed By: mondaychen, csantos42 Differential Revision: D31566788 fbshipit-source-id: 87360c4f752cc3cc05c725e27febd6d18679db60
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
Oct 19, 2021
This pull request was exported from Phabricator. Differential Revision: D31566788 |
This pull request has been merged in 36016ae. |
AlexGuz23
pushed a commit
to AlexGuz23/Recoil
that referenced
this pull request
Nov 3, 2022
Summary: Pull Request resolved: facebookexperimental/Recoil#1312 Export `isLoadable()` as part of the `RecoilLoadable` interface for Loadables. Reviewed By: mondaychen, csantos42 Differential Revision: D31566788 fbshipit-source-id: c160bd4d1d1635ef39bb2cd5c29e49431399a252
snipershooter0701
pushed a commit
to snipershooter0701/Recoil
that referenced
this pull request
Mar 5, 2023
Summary: Pull Request resolved: facebookexperimental/Recoil#1312 Export `isLoadable()` as part of the `RecoilLoadable` interface for Loadables. Reviewed By: mondaychen, csantos42 Differential Revision: D31566788 fbshipit-source-id: c160bd4d1d1635ef39bb2cd5c29e49431399a252
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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
Merged
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: Export
isLoadable()
as part of theRecoilLoadable
interface for Loadables.Reviewed By: mondaychen, csantos42
Differential Revision: D31566788