Skip to content

Commit

Permalink
fix: interop Zustand for CJS (#1550)
Browse files Browse the repository at this point in the history
  • Loading branch information
CodyJasonBennett authored Jun 30, 2023
1 parent 290272d commit 1dfc307
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 3 deletions.
6 changes: 5 additions & 1 deletion src/core/useProgress.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
import { DefaultLoadingManager } from 'three'
import create from 'zustand'
import zustand from 'zustand'

// TODO: upgrade to v4
// https://github.com/pmndrs/drei/pull/1550
const create = (zustand as any).default as typeof zustand

type Data = {
errors: string[]
Expand Down
6 changes: 5 additions & 1 deletion src/web/KeyboardControls.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,11 @@
import * as React from 'react'
import create, { StoreApi, UseBoundStore } from 'zustand'
import zustand, { StoreApi, UseBoundStore } from 'zustand'
import { subscribeWithSelector } from 'zustand/middleware'

// TODO: upgrade to v4
// https://github.com/pmndrs/drei/pull/1550
const create = (zustand as any).default as typeof zustand

// These are removed in Zustand v4
type State = object // unknown
type StateSelector<T extends State, U> = (state: T) => U
Expand Down
6 changes: 5 additions & 1 deletion src/web/Select.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,11 @@ import * as React from 'react'
import * as THREE from 'three'
import { SelectionBox } from 'three-stdlib'
import { useThree } from '@react-three/fiber'
import shallow from 'zustand/shallow'
import zustand from 'zustand/shallow'

// TODO: upgrade to v4
// https://github.com/pmndrs/drei/pull/1550
const shallow = (zustand as any).default as typeof zustand

const context = React.createContext<THREE.Object3D[]>([])

Expand Down

1 comment on commit 1dfc307

@vercel
Copy link

@vercel vercel bot commented on 1dfc307 Jun 30, 2023

Choose a reason for hiding this comment

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

Please sign in to comment.