Skip to content

Commit

Permalink
bring back use-sync-external-store shim
Browse files Browse the repository at this point in the history
  • Loading branch information
pacocoursey committed Nov 1, 2024
1 parent 5b4f24d commit c5470e3
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 3 deletions.
5 changes: 3 additions & 2 deletions cmdk/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "cmdk",
"version": "1.0.2",
"version": "1.0.3",
"license": "MIT",
"main": "./dist/index.js",
"module": "./dist/index.mjs",
Expand Down Expand Up @@ -28,7 +28,8 @@
"dependencies": {
"@radix-ui/react-dialog": "^1.1.2",
"@radix-ui/react-id": "^1.1.0",
"@radix-ui/react-primitive": "^2.0.0"
"@radix-ui/react-primitive": "^2.0.0",
"use-sync-external-store": "^1.2.2"
},
"devDependencies": {
"@types/react": "18.0.15"
Expand Down
3 changes: 2 additions & 1 deletion cmdk/src/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import * as React from 'react'
import { commandScore } from './command-score'
import { Primitive } from '@radix-ui/react-primitive'
import { useId } from '@radix-ui/react-id'
import { useSyncExternalStore } from 'use-sync-external-store/shim'

type Children = { children?: React.ReactNode }
type DivProps = React.ComponentPropsWithoutRef<typeof Primitive.div>
Expand Down Expand Up @@ -1017,7 +1018,7 @@ function mergeRefs<T = any>(refs: Array<React.MutableRefObject<T> | React.Legacy
function useCmdk<T = any>(selector: (state: State) => T) {
const store = useStore()
const cb = () => selector(store.snapshot())
return React.useSyncExternalStore(store.subscribe, cb, cb)
return useSyncExternalStore(store.subscribe, cb, cb)
}

function useValue(
Expand Down
11 changes: 11 additions & 0 deletions pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 comment on commit c5470e3

@erictuvesson
Copy link

@erictuvesson erictuvesson commented on c5470e3 Nov 1, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This broke my server today when I did a redeploy. :(

Edit: I locked the version to the previous release and my app is back up.

Please sign in to comment.