diff --git a/packages/editor/src/lib/TldrawEditor.tsx b/packages/editor/src/lib/TldrawEditor.tsx index 688261232..5625b98a0 100644 --- a/packages/editor/src/lib/TldrawEditor.tsx +++ b/packages/editor/src/lib/TldrawEditor.tsx @@ -175,12 +175,8 @@ function TldrawEditorWithOwnStore( const TldrawEditorWithLoadingStore = memo(function TldrawEditorBeforeLoading({ store, - assetUrls, ...rest }: Required) { - const assets = useDefaultEditorAssetsWithOverrides(assetUrls) - const { done: preloadingComplete, error: preloadingError } = usePreloadAssets(assets) - switch (store.status) { case 'error': { // for error handling, we fall back to the default error boundary. @@ -202,14 +198,6 @@ const TldrawEditorWithLoadingStore = memo(function TldrawEditorBeforeLoading({ } } - if (preloadingError) { - return Could not load assets. Please refresh the page. - } - - if (!preloadingComplete) { - return Loading assets... - } - return }) @@ -220,6 +208,7 @@ function TldrawEditorWithReadyStore({ tools, shapes, autoFocus, + assetUrls, }: Required< TldrawEditorProps & { store: TLStore @@ -277,6 +266,17 @@ function TldrawEditorWithReadyStore({ () => editor?.crashingError ?? null ) + const assets = useDefaultEditorAssetsWithOverrides(assetUrls) + const { done: preloadingComplete, error: preloadingError } = usePreloadAssets(assets) + + if (preloadingError) { + return Could not load assets. Please refresh the page. + } + + if (!preloadingComplete) { + return Loading assets... + } + if (!editor) { return null }