1- import { useEffect , useState } from 'react' ;
1+ import { useEffect } from 'react' ;
22import { toast } from 'sonner' ;
33import { 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