-
-
Notifications
You must be signed in to change notification settings - Fork 3.2k
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
feat(createGlobalState)!: Align API with React.useState #1021
base: master
Are you sure you want to change the base?
Conversation
c10ad48
to
9612d69
Compare
There is a function and types in utils for native-like state management |
Fixes streamich#785 - useLocalStorage not updating if many components watch the same key This pull request depends on pull requests streamich#1021 streamich#979
I'll update the PR tomorrow to use those types. |
0349d61
to
1e9286f
Compare
@xobotyi Updated. |
Fixes streamich#785 - useLocalStorage not updating if many components watch the same key This pull request depends on pull requests streamich#1021 streamich#979
Fixes streamich#785 - useLocalStorage not updating if many components watch the same key This pull request depends on pull requests streamich#1021 streamich#979
Fixes streamich#785 - useLocalStorage not updating if many components watch the same key Previously pr streamich#786 addressed this issue by ensuring that other components watching the key would see new updates, however, those updates would not be rendered until something else triggered a re-render. This pr resolves that issue. This pull request depends on pull requests streamich#1021 streamich#979
Fixes streamich#785 - useLocalStorage not updating if many components watch the same key Previously pr streamich#786 addressed this issue by ensuring that other components watching the key would see new updates, however, those updates would not be rendered until something else triggered a re-render. This pr resolves that issue. This pull request depends on pull requests streamich#1021 streamich#979
Fixes streamich#785 - useLocalStorage not updating if many components watch the same key Previously pr streamich#786 addressed this issue by ensuring that other components watching the key would see new updates, however, those updates would not be rendered until something else triggered a re-render. This pr resolves that issue. This pull request depends on pull requests streamich#1021 streamich#979
Fixes streamich#785 - useLocalStorage not updating if many components watch the same key Previously pr streamich#786 addressed this issue by ensuring that other components watching the key would see new updates, however, those updates would not be rendered until something else triggered a re-render. This pr resolves that issue. This pull request depends on pull requests streamich#1021 streamich#979
This commit adds support for functional updates to align with the React.useState API. Type definitions are updated to match useState. This might break existing code that expects functions to be held in the global state, rather than applied as an update. This change may also cause new type errors.
1e9286f
to
f905c53
Compare
Fixes streamich#785 - useLocalStorage not updating if many components watch the same key Previously pr streamich#786 addressed this issue by ensuring that other components watching the key would see new updates, however, those updates would not be rendered until something else triggered a re-render. This pr resolves that issue. This pull request depends on pull requests streamich#1021 streamich#979
Makes the call synchronous to avoid race conditions, and works with SSR. See comment at: streamich#1060 (comment)
I've updated this PR to address comments, and to account for a comment made here, superseding #1060 @xobotyi @streamich |
Fixes streamich#785 - useLocalStorage not updating if many components watch the same key Previously pr streamich#786 addressed this issue by ensuring that other components watching the key would see new updates, however, those updates would not be rendered until something else triggered a re-render. This pr resolves that issue. This pull request depends on pull requests streamich#1021 streamich#979
Watched it briefly, looks good for me. |
FYI, my local branch has a couple of type improvements that I plan to commit tomorrow. |
I never got around to pushing some type fixes. I'll try to get to that
tonight.
…On Tue, Dec 8, 2020, 12:41 Thomas Aribart ***@***.***> wrote:
@nspaeth <https://github.com/nspaeth> @xobotyi
<https://github.com/xobotyi> Is this pull request still planned to be
merged ?
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
<#1021 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AAL5NEMUD3WJ2T5JPARVGNDSTZXL3ANCNFSM4LAZ3NZA>
.
|
Any update on this? |
Description
Adds support for functional updates to align with the
React.useState
API. Type definitions are updated to be compatible with
useState
.This might break existing code that expects functions to be held in the global
state, rather than applied as an update.
This change may also cause new type errors.
Type of change
Checklist
yarn test
)yarn lint
). Fix it withyarn lint:fix
in case of failure.yarn lint:types
).