Skip to content
Source
Sign inSign up
TanStack/redact

fix: expose useSyncExternalStoreWithSelector on the default export #32

Openletstri(GitHub profile, opens in a new tab)wants to merge 1 commit intomain fromrefs/pull/32/headopened

Showing 3 changed files with 77 additions and 0 deletions.

x
0 of 3 viewed, 3 left
5 additions and 0 deletions.changeset/sync-external-store-default.mdAdded
View file
@@ -0,0 +1,5 @@
+---
+'@tanstack/redact': patch
+---
+​
+Put `useSyncExternalStoreWithSelector` on the default export. The Vite plugin aliases `use-sync-external-store/shim/with-selector` here, and zustand reads it as a CJS default import (`import shim from '...'; const { useSyncExternalStoreWithSelector } = shim`), so anything built on zustand's `useStoreWithEqualityFn` — React Flow, for one — threw `useSyncExternalStoreWithSelector is not a function`.
4 additions and 0 deletionspackages/redact/src/react/index.tsModified
View file
@@ -104,6 +104,7 @@
useTransition,
useDeferredValue,
useSyncExternalStore,
+ useSyncExternalStoreWithSelector,
use,
useActionState,
useFormStatus,
@@ -141,6 +142,9 @@
useTransition,
useDeferredValue,
useSyncExternalStore,
+ // `use-sync-external-store/shim/with-selector` aliases here, and zustand
+ // reads it as a CJS default import.
+ useSyncExternalStoreWithSelector,
use,
useActionState,
useFormStatus,
68 additions and 0 deletionstests/default-export-shim.test.tsxAdded
View file