diff --git a/package.json b/package.json index c14ae3f7a..1d3ee3b1b 100644 --- a/package.json +++ b/package.json @@ -132,7 +132,8 @@ "textarea-caret": "^3.1.0", "tslib": "^2.6.2", "unist-builder": "^3.0.0", - "unist-util-visit": "^5.0.0" + "unist-util-visit": "^5.0.0", + "use-sync-external-store": "^1.4.0" }, "optionalDependencies": { "@stream-io/transliterate": "^1.5.5", @@ -207,6 +208,7 @@ "@types/react-image-gallery": "^1.2.4", "@types/react-is": "^18.2.4", "@types/textarea-caret": "3.0.0", + "@types/use-sync-external-store": "^0.0.6", "@types/uuid": "^8.3.0", "@typescript-eslint/eslint-plugin": "5.62.0", "@typescript-eslint/parser": "5.62.0", diff --git a/src/store/hooks/useStateStore.ts b/src/store/hooks/useStateStore.ts index 44b1f7fd7..11a5a4010 100644 --- a/src/store/hooks/useStateStore.ts +++ b/src/store/hooks/useStateStore.ts @@ -1,4 +1,5 @@ -import { useCallback, useMemo, useSyncExternalStore } from 'react'; +import { useCallback, useMemo } from 'react'; +import { useSyncExternalStore } from 'use-sync-external-store/shim'; import type { StateStore } from 'stream-chat'; diff --git a/yarn.lock b/yarn.lock index 91a4498fb..af896d42b 100644 --- a/yarn.lock +++ b/yarn.lock @@ -2769,6 +2769,11 @@ resolved "https://registry.yarnpkg.com/@types/unist/-/unist-2.0.6.tgz#250a7b16c3b91f672a24552ec64678eeb1d3a08d" integrity sha512-PBjIUxZHOuj0R15/xuwJYjFi+KZdNFrehocChv4g5hu6aFroHue8m0lBP0POdK2nKzbw0cgV1mws8+V/JAcEkQ== +"@types/use-sync-external-store@^0.0.6": + version "0.0.6" + resolved "https://registry.yarnpkg.com/@types/use-sync-external-store/-/use-sync-external-store-0.0.6.tgz#60be8d21baab8c305132eb9cb912ed497852aadc" + integrity sha512-zFDAD+tlpf2r4asuHEj0XH6pY6i0g5NeAHPn+15wk3BV6JA69eERFXC1gyGThDkVa1zCyKr5jox1+2LbV/AMLg== + "@types/uuid@^8.3.0": version "8.3.0" resolved "https://registry.yarnpkg.com/@types/uuid/-/uuid-8.3.0.tgz#215c231dff736d5ba92410e6d602050cce7e273f" @@ -13197,6 +13202,11 @@ use-latest@^1.0.0: dependencies: use-isomorphic-layout-effect "^1.0.0" +use-sync-external-store@^1.4.0: + version "1.4.0" + resolved "https://registry.yarnpkg.com/use-sync-external-store/-/use-sync-external-store-1.4.0.tgz#adbc795d8eeb47029963016cefdf89dc799fcebc" + integrity sha512-9WXSPC5fMv61vaupRkCKCxsPxBocVnwakBEkMIHHpkTTg6icbJtg6jzgtLDm4bl3cSHAca52rYWih0k4K3PfHw== + use@^3.1.0: version "3.1.1" resolved "https://registry.yarnpkg.com/use/-/use-3.1.1.tgz#d50c8cac79a19fbc20f2911f56eb973f4e10070f"