Merged
Conversation
|
| Name | Link |
|---|---|
| 🔨 Latest commit | 7afe4ab |
443fdb5 to
3981efa
Compare
506533e to
0d638e8
Compare
| <div> | ||
| <p>{prefix}</p> | ||
| <p>{text}</p> | ||
| </div> |
| const user = createStore('guest') | ||
| const friends = createStore<string[]>([]) | ||
| const user = createStore('guest', {sid: 'user'}) | ||
| const friends = createStore<string[]>([], {sid: 'friends'}) |
| }, [store, scope]) | ||
| const subscribe = (cb: () => void) => createWatch(store, cb, scope) | ||
| const read = () => stateReader(store, scope) | ||
| const currentValue = useSyncExternalStore(subscribe, read, read) |
Member
Author
There was a problem hiding this comment.
Third argument is getServerSnapshot - in case of effector there is no difference with client version
https://reactjs.org/docs/hooks-reference.html#usesyncexternalstore
Member
|
@AlexandrHoroshih What about to upgrade react-17 to react-18? |
Member
Author
|
@sergeysova It is upgraded in the repo 🤔 It is implementation of |
Member
|
@AlexandrHoroshih Oh, yeah. I see that https://github.com/AlexandrHoroshih/effector/blob/react-18/package.json#L96-L99 |
keep old fixture for backward compatibility tests
effector-react must be updated to work correctly with react-18, but at the same time it should not break react-17 compatiblity
due to substitution of react-18 to react-17 sids may be different each time
TODO: remove, once react-17 support is deprecated
bug is not reproduced, hmm
react-dom of 18 renders empty string slightly different, but it is not a concern of tests for effector-react at all also IS_REACT_ACT can just be always true, since react-17 does not know about that
refactor react 17 script
Previous custom implementation prevented re-computation of `fn`, if none of the keys in `useStoreMap` was changed This test catches this behaviour and will pass with previous implementation, but currently it fails with the new one, based on official `use-sync-external-store`, since `useSyncExternalStoreWithSelector` does not accept keys Need to add some custom memoization for that in the new implementation
It is needed to comply with previous behavior of useStoreMap
inline condition instead of function, one return instead of few
86c12ec to
6a350de
Compare
sergeysova
approved these changes
May 15, 2022
This file contains hidden or 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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Closes #643
Changelog
reactandreact-domto latest 18.x.x versionreact-17version - changes forreact-18compatibility should not break usage of effector withreact-17effector-reactimplementation to officialuseSyncExternalStorefor integration withreact-18and shim ofuseSyncExternalStoreforreact-17fninuseStoreMap- previous implementation prevented re-computation offnduring render, if both store state and keys were not changed. New implementation must keep this behaviour (test: 6790129)