File tree Expand file tree Collapse file tree 1 file changed +2
-13
lines changed Expand file tree Collapse file tree 1 file changed +2
-13
lines changed Original file line number Diff line number Diff line change @@ -22,11 +22,8 @@ export default function LiveHtmlEditor({ fileUrl }) {
22
22
setCode ( text ) ;
23
23
setLoading ( false ) ;
24
24
} else if ( response . status === 404 ) {
25
- // Remove the last directory from the url
26
- const directoryUrl = url . substring ( 0 , url . lastIndexOf ( '/' ) ) ;
27
-
28
- // Recursively try to fetch the file from the parent directory
29
- fetchFile ( `${ directoryUrl } /${ filename } ` ) ;
25
+ // Try to fetch the file from the root of the examples directory
26
+ fetchFile ( `/examples/${ filename } ` ) ;
30
27
} else {
31
28
throw new Error ( `HTTP error! status: ${ response . status } ` ) ;
32
29
}
@@ -38,14 +35,6 @@ export default function LiveHtmlEditor({ fileUrl }) {
38
35
setLoading ( false ) ;
39
36
} ) ;
40
37
} , [ fileUrl , fetchFile ] ) ;
41
-
42
- useEffect ( ( ) => {
43
- fetchFile ( fileUrl ) . catch ( error => {
44
- setError ( error . message ) ;
45
- setLoading ( false ) ;
46
- } ) ;
47
- } , [ fileUrl , fetchFile ] ) ;
48
-
49
38
50
39
if ( loading ) {
51
40
return < div > Loading...</ div > ;
You can’t perform that action at this time.
0 commit comments