-
-
Notifications
You must be signed in to change notification settings - Fork 1.6k
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
fix: import use-sync-external-store in esm #829
Conversation
Imports `use-sync-external-store/shim/with-selector.js` (with a `.js` suffix) so that it is correctly resolved by esm bundlers like nextjs. Fixes Uniswap/web3-react#379, which is broken using [4.0.0-beta.1](https://www.npmjs.com/package/zustand/v/4.0.0-beta.1).
Hi, thanks for your suggestion! Meanwhile, I think we can merge this PR, but there's no guarantee that this is kept. It might be reverted if any other issues occur. Also, do you think, in web3-react config, it's possible to use CJS instead of ESM? The community will have a hard time transitioning from CJS to ESM for a while... |
I think this is important to merge for interim esm compatibility. I can open an issue upstream as well. I'm working with @NoahZinsmeister, the author of web3-react, on getting the CJS entries updated, but I'm not sure if he'd want to default to CJS (as opposed to supporting both options). If you do merge this, could you also release a patch via npm so we're able to use it with esm? |
Note that this is just a workaround.
I need to merge something else too. No ETA. I really wish codesandbox ci works. (It's broken for these couple of days.) I would suggest |
Let's see how 64536ee goes. |
* imaginary code that uses uSES * revert backward compatibility code as this is not going to be v4 * use use-sync-external-store * revert to react 17 * handle error by our own * v4.0.0-alpha.2 * fix&refactor a bit * update uSES experimental package * remove error propagation hack * update size snapshot * update uSES and add dts * split react.ts and no export wild * split useStore impl * context to follow the new api, export wild again * v4.0.0-alpha.3 * add missing await * update uSES * update uSES * uses uSES extra! * v4.0.0-alpha.3 * update uSES * fix update uSES * v4.0.0-alpha.5 * add useDebugValue * update uSES * update uSES types * update uSES * v4.0.0-alpha.6 * fix(readme): remove memoization section which is no longer valid with uSES * feat(readme): add new createStore/useStore usage * update useSES * update uSES and deps * v4.0.0-alpha.7 * update uSES * update uSES * shave bytes * update uSES * fix yarn lock * temporary fix #829 * uSES rc.1 * getServerState for #886, no types yet * uSES v1
* imaginary code that uses uSES * revert backward compatibility code as this is not going to be v4 * use use-sync-external-store * revert to react 17 * handle error by our own * v4.0.0-alpha.2 * fix&refactor a bit * update uSES experimental package * remove error propagation hack * update size snapshot * update uSES and add dts * split react.ts and no export wild * split useStore impl * context to follow the new api, export wild again * v4.0.0-alpha.3 * add missing await * update uSES * update uSES * uses uSES extra! * v4.0.0-alpha.3 * fix(types): Rename from UseStore to UseBoundStore * breaking(types): drop deprecated UseStore type * breaking(core): drop v2 hook compatibility * breaking(middleware): drop deprecated persist options * breaking(core): drop deprecated store.subscribe with selector * update uSES * fix update uSES * v4.0.0-alpha.5 * combine subscribe type * intentional undefined type * add useDebugValue * update uSES * update uSES types * breaking(middleware): make persist options.removeItem required * update uSES * v4.0.0-alpha.6 * fix(readme): remove memoization section which is no longer valid with uSES * feat(readme): add new createStore/useStore usage * update useSES * update uSES and deps * v4.0.0-alpha.7 * update uSES * update uSES * shave bytes * update uSES * breaking(middleware/devtools): use official devtools extension types * type object.create * avoid emitting @redux-devtools/extension * fix type with any * refactor * fix yarn lock * temporary fix #829 * v4.0.0-beta.2 * fix lint * lock date-fns version * lock testing-library/react alpha version * devtools: remove deprecations and warnings * fix tests * use `__DEV__` * revert irrelevant v4 changes * correct merge * fix test * fix `any` * fix `any` again Co-authored-by: daishi <daishi@axlight.com>
* imaginary code that uses uSES * revert backward compatibility code as this is not going to be v4 * use use-sync-external-store * revert to react 17 * handle error by our own * v4.0.0-alpha.2 * fix&refactor a bit * update uSES experimental package * remove error propagation hack * update size snapshot * update uSES and add dts * split react.ts and no export wild * split useStore impl * context to follow the new api, export wild again * v4.0.0-alpha.3 * add missing await * update uSES * update uSES * uses uSES extra! * v4.0.0-alpha.3 * fix(types): Rename from UseStore to UseBoundStore * breaking(types): drop deprecated UseStore type * breaking(core): drop v2 hook compatibility * breaking(middleware): drop deprecated persist options * breaking(core): drop deprecated store.subscribe with selector * update uSES * fix update uSES * v4.0.0-alpha.5 * combine subscribe type * intentional undefined type * add useDebugValue * update uSES * update uSES types * breaking(middleware): make persist options.removeItem required * update uSES * v4.0.0-alpha.6 * fix(readme): remove memoization section which is no longer valid with uSES * feat(readme): add new createStore/useStore usage * update useSES * update uSES and deps * v4.0.0-alpha.7 * update uSES * update uSES * shave bytes * vanilla: add higher kinded mutator types * persist: add higher kinded mutator types * persist: try to minimize diff * use `PopArgument` in vanilla too * update uSES * use overloads instead of `createWithState` * avoid symbols * add new types to middlewares * add new types react * add new types to context * fix persist types * add immer * migrate middleware type tests * fix react type, export `UseBoundStore` * migrate vanilla type tests * rename `_createStore` to `createStoreImpl` * Default to no mutations in `StateCreator` * migrate context.test.tsx * fix devtools.test.tsx type erros * context: remove callsignature in useStoreApi * context: remove `UseContextStore` type * context: fix useBoundStore type * context: keep `UseContextStore` for tooltip just don't export it * react: remove duplicate overload in create * export `WithPersist` * devtools: preserve try/catch * devtools: preserve window check * add a test case for v3 style create * devtools: preverse test fix from base branch * remove StoreApiWithFoo types, don't export WithFoo types * style * devtools: preverse `originalIsRecording` change * fix bug in devtools * empty commit * 4.0.0-beta.1 * fix lint * style * export immer fix tests * style, minor fixes * devtools: fix test * Update tests/devtools.test.tsx * breaking(middleware/devtools): use official devtools extension types * type object.create * avoid emitting @redux-devtools/extension * fix type with any * refactor * fix yarn lock * temporary fix #829 * v4.0.0-beta.2 * fix lint * lock date-fns version * test middleware subtyping * fix errors in conflict resolution * lock testing-library/react alpha version * more correct (and strict) persist types * migrate tests * wip release notes * fix devtools merge with base Co-authored-by: Daishi Kato <dai-shi@users.noreply.github.com> * add a test case for persist with partialize option * update readme * fix lint * immer: mutate `store.setState` * fix devtools merge with base * immer: fix mutations order * changes in readme * move and rename v4 migration md * add `combine` usage in readme * typos * create separate md for typescript, add common recipes * minor fixes * devtools: minor type fix (probably I copy pasted from persist and forgot to remove `U`) * add more migrations * context: fix import Co-authored-by: Daishi Kato <dai-shi@users.noreply.github.com> * devtools: minor refactor rearrange code for better diff * fix lint: run prettier * wip * uSES rc.1 * getServerState for #886, no types yet * uSES v1 * devtools: remove deprecations and warnings * fix tests * v4.0.0-beta.2 * wip * migrate tests * persist: keep diff minimal * fix merge in package.json and yarn.lock * fix merge for persist * don't use `import type` * docs(typescript): add slices pattern * fix selector & equals types for inference with useCallback, see issue #812 * add test for setState with replace * remove undefined selector overload * make immer more generic * make devtools replace-friendly and more correctly typed * migrate tests * make setState bivariant to make the state covariant * devtools: return the result of `setState` * devtools: make the fallback branch in `StoreSetStateWithAction` bivariant too (I forgot to make this bivaraint) * remove strict replace * fix lint Co-authored-by: daishi <daishi@axlight.com> Co-authored-by: Daishi Kato <dai-shi@users.noreply.github.com>
Imports
use-sync-external-store/shim/with-selector.js
(with a.js
suffix) so that it is correctly resolved by esm bundlers like nextjs.Fixes Uniswap/web3-react#379, which is broken using 4.0.0-beta.1.