We currently have some circular dependencies in the codebase, found using the vite-plugin-circular-dependency plugin.
../../packages/state/src/lib/core/EffectScheduler.ts
../../packages/state/src/lib/core/EffectScheduler.ts -> ../../packages/state/src/lib/core/transactions.ts
../../packages/editor/src/index.ts
../../packages/editor/src/index.ts -> ../../packages/editor/src/lib/TldrawEditor.tsx -> ../../packages/editor/src/lib/components/Canvas.tsx -> ../../packages/editor/src/lib/components/ShapeIndicator.tsx -> ../../packages/editor/src/lib/hooks/useEditorComponents.tsx
../../packages/editor/src/lib/components/Canvas.tsx
../../packages/editor/src/lib/components/Canvas.tsx -> ../../packages/editor/src/lib/components/default-components/DefaultErrorFallback.tsx -> ../../packages/editor/src/lib/hooks/useEditorComponents.tsx
../../packages/editor/src/lib/TldrawEditor.tsx
../../packages/editor/src/lib/TldrawEditor.tsx -> ../../packages/editor/src/lib/components/default-components/DefaultLoadingScreen.tsx
../../packages/tldraw/src/lib/shapes/frame/FrameShapeUtil.tsx
../../packages/tldraw/src/lib/shapes/frame/FrameShapeUtil.tsx -> ../../packages/tldraw/src/lib/shapes/frame/components/FrameHeading.tsx -> ../../packages/tldraw/src/lib/shapes/frame/components/FrameLabelInput.tsx
We should aim to fix these and put guardrails in place so it doesn't happen in the future. (It looks like circleImportThrowErr will help do this in the plugin).
I came across this as I was trying to write some Jest tests for my PR (I was trying to set up a mock for @tldraw/editor) but it looks like it wsa hampered by running into a circ. dep. issue.
cc @ds300 this might need your eyes, at least on the first one with EffectScheduler
We currently have some circular dependencies in the codebase, found using the
vite-plugin-circular-dependencyplugin.We should aim to fix these and put guardrails in place so it doesn't happen in the future. (It looks like
circleImportThrowErrwill help do this in the plugin).I came across this as I was trying to write some Jest tests for my PR (I was trying to set up a mock for
@tldraw/editor) but it looks like it wsa hampered by running into a circ. dep. issue.cc @ds300 this might need your eyes, at least on the first one with
EffectScheduler