diff --git a/packages/state/package.json b/packages/state/package.json index c6037198c..003a5ddd2 100644 --- a/packages/state/package.json +++ b/packages/state/package.json @@ -52,9 +52,6 @@ "node_modules/(?!(nanoid)/)" ] }, - "dependencies": { - "@tldraw/utils": "workspace:*" - }, "devDependencies": { "@types/lodash": "^4.14.188", "@types/react": "^18.2.47", diff --git a/packages/state/src/lib/react/useStateTracking.ts b/packages/state/src/lib/react/useStateTracking.ts index fbd60fe5c..f46786b34 100644 --- a/packages/state/src/lib/react/useStateTracking.ts +++ b/packages/state/src/lib/react/useStateTracking.ts @@ -1,4 +1,3 @@ -import { fpsThrottle } from '@tldraw/utils' import React from 'react' import { EffectScheduler } from '../core' @@ -27,9 +26,9 @@ export function useStateTracking(name: string, render: () => T): T { () => renderRef.current?.(), // this is what will be invoked when @tldraw/state detects a change in an upstream reactive value { - scheduleEffect: fpsThrottle(() => { + scheduleEffect() { scheduleUpdate?.() - }), + }, } ) diff --git a/packages/state/src/lib/react/useValue.ts b/packages/state/src/lib/react/useValue.ts index 4e8d7fa1f..8d4384a5b 100644 --- a/packages/state/src/lib/react/useValue.ts +++ b/packages/state/src/lib/react/useValue.ts @@ -1,5 +1,4 @@ /* eslint-disable prefer-rest-params */ -import { throttleToNextFrame } from '@tldraw/utils' import { useMemo, useRef, useSyncExternalStore } from 'react' import { Signal, computed, react } from '../core' @@ -82,16 +81,10 @@ export function useValue() { const { subscribe, getSnapshot } = useMemo(() => { return { subscribe: (listen: () => void) => { - return react( - `useValue(${name})`, - () => { - $val.get() - listen() - }, - { - scheduleEffect: throttleToNextFrame, - } - ) + return react(`useValue(${name})`, () => { + $val.get() + listen() + }) }, getSnapshot: () => $val.get(), } diff --git a/packages/state/tsconfig.json b/packages/state/tsconfig.json index be43fd20f..662a89b2d 100644 --- a/packages/state/tsconfig.json +++ b/packages/state/tsconfig.json @@ -5,10 +5,5 @@ "compilerOptions": { "outDir": "./.tsbuild", "rootDir": "src" - }, - "references": [ - { - "path": "../utils" - } - ] + } } diff --git a/yarn.lock b/yarn.lock index b81c7452e..c53bbc5fd 100644 --- a/yarn.lock +++ b/yarn.lock @@ -7356,7 +7356,6 @@ __metadata: version: 0.0.0-use.local resolution: "@tldraw/state@workspace:packages/state" dependencies: - "@tldraw/utils": "workspace:*" "@types/lodash": "npm:^4.14.188" "@types/react": "npm:^18.2.47" "@types/react-test-renderer": "npm:^18.0.0"