-
-
Notifications
You must be signed in to change notification settings - Fork 1.5k
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: use-sync-external-store #550
Conversation
This pull request is automatically built and testable in CodeSandbox. To see build info of the built libraries, click here or the icon next to each commit SHA. Latest deployment of this branch, based on commit 1be05d1:
|
Four tests failed:
I feel like we should hit v4 major with breaking changes. |
I hacked around, but not sure if this causes a problem with cases where we used to have zombie children. |
tests/basic.test.tsx
Outdated
@@ -150,7 +150,9 @@ it('re-renders with useLayoutEffect', async () => { | |||
|
|||
const container = document.createElement('div') | |||
ReactDOM.render(<Component />, container) | |||
expect(container.innerHTML).toBe('true') | |||
waitFor(() => { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I believe you need an await
in front?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Oh, nice catch. I hope it works with await
.
Size Change: -2.58 kB (-8%) ✅ Total Size: 30 kB
ℹ️ View Unchanged
|
@dai-shi I noticed that you removed the Is not needed anymore? |
@phaistonian Yes. Please see #971. |
No, I don't think so. |
As per the discussions below, memoizing selectors does not improve performance significantly as of v4. Thus we should avoid recommending selector memoization. Note that the same paragraph was removed from the README in PR #550 (#550) and this section may have been left behind as an oversight. - #658 - #971
As per the discussions below, memoizing selectors does not improve performance significantly as of v4. Thus we should avoid recommending selector memoization. Note that the same paragraph was removed from the README in PR #550 (pmndrs/zustand#550) and this section may have been left behind as an oversight. - pmndrs/zustand#658 - pmndrs/zustand#971
No public API changes
The API is compatible with the latest v3 API
Major changes
Better support for context usage
useStore
hook.createStore
fromzustand/vanilla
zustand/context
is fully rewritten with the newuseStore
.