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

The Vite plugin aliases use-sync-external-store/shim/with-selector to this package, and zustand reads it as a CJS default import:

import useSyncExternalStoreExports from 'use-sync-external-store/shim/with-selector.js'
const { useSyncExternalStoreWithSelector } = useSyncExternalStoreExports

useSyncExternalStoreWithSelector is only a named export here, so that destructure gives undefined and anything on zustand's useStoreWithEqualityFn throws useSyncExternalStoreWithSelector is not a function. React Flow hits it on first render, in HandleConfigProvider.

Adds it to the default export next to useSyncExternalStore, which is already there for the plain use-sync-external-store/shim alias.

Covered by tests/default-export-shim.test.tsx.

    1. Warning

      Review limit reached

      Next included review available in 1 minute.

      Check out review usage here.

      View limit details

      Limit details: You’ve used all 2 included reviews currently available.

      You've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository.

      Learn how review limits work.

      Review configuration:

      ⚙️ Run configuration

      Configuration used: defaults

      Review profile: CHILL

      Plan: Advanced

      Run ID: 02dfa19f-db3a-4468-a31b-6b9aa2b2a0fb

      📥 Commits

      Reviewing files that changed from the base of the PR and between 4ab81196f8af5857028d0ea486f067bb90e2293b and e074bca744a11bf11aee3a2c05c81e80d9cd8a34.

      📒 Files selected for processing (3)
      • .changeset/sync-external-store-default.md
      • packages/redact/src/react/index.ts
      • tests/default-export-shim.test.tsx

      Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

      ❤️ Share
      Comment `@coderabbitai help` to get the list of available commands.
    2. Thanks @letstri, your default-export fix and regression tests landed through #76 and are included in 0.2.4.

      AI review notes: Current main includes useSyncExternalStoreWithSelector on the default React export, and retains the rendered selector-update regression coverage. The verified 0.2.4 package matches its release source across 347 built files. This PR’s implementation is already covered by that release.

Sign in to join this conversation.