Skip to content

Commit c041f2a

Browse files
authored
fix(apps/official-website): Editor Model loading
1 parent 08e4c35 commit c041f2a

File tree

1 file changed

+3
-14
lines changed

1 file changed

+3
-14
lines changed

apps/official-website/src/pages/editor/editor.tsx

Lines changed: 3 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { useEffect, useState } from 'react';
1+
import { useEffect } from 'react';
22
import { toast } from 'sonner';
33
import { Vector3 } from 'three';
44

@@ -25,10 +25,8 @@ const Editor = () => {
2525
!!window.sessionStorage.getItem('hasShownInfo'),
2626
);
2727

28-
const [hasInput, setHasInput] = useState(false);
29-
3028
function handleReset() {
31-
setHasInput(false);
29+
reset()
3230
}
3331

3432
function handleNotLoadedFiles(files?: File[]) {
@@ -44,9 +42,6 @@ const Editor = () => {
4442
function handleLoadError(error: unknown) {
4543
console.error('Load error:', error);
4644
toast.error(error as string);
47-
48-
setHasInput(false);
49-
reset();
5045
}
5146

5247
function handleLoadStart() {
@@ -74,12 +69,6 @@ const Editor = () => {
7469
// eslint-disable-next-line react-hooks/exhaustive-deps
7570
}, []);
7671

77-
useEffect(() => {
78-
if (isFileLoading && !hasInput) {
79-
setHasInput(true);
80-
}
81-
}, [isFileLoading, hasInput]);
82-
8372
function handleClose() {
8473
setHasShownInfo(true);
8574
// To avoid showing the dialog again during the session
@@ -90,7 +79,7 @@ const Editor = () => {
9079
<section className="h-dvh overflow-hidden mx-[-1rem]">
9180
<UploadInfoDialog open={!hasShownInfo} onClose={handleClose} />
9281

93-
{hasInput ? (
82+
{file ? (
9483
<VectrealViewer
9584
model={file?.model}
9685
key="model-viewer"

0 commit comments

Comments
 (0)