File tree Expand file tree Collapse file tree 1 file changed +8
-2
lines changed
Expand file tree Collapse file tree 1 file changed +8
-2
lines changed Original file line number Diff line number Diff line change @@ -35,11 +35,17 @@ export default function Dashboard() {
3535 }
3636 }
3737
38+ // Helper to resolve URLs against base (Safari doesn't respect <base> for fetch)
39+ const resolveUrl = ( path : string ) => {
40+ const base = document . baseURI || window . location . href
41+ return new URL ( path , base ) . href
42+ }
43+
3844 // Load image list
3945 useEffect ( ( ) => {
4046 async function loadImageList ( ) {
4147 try {
42- const response = await fetch ( 'image-list.json' )
48+ const response = await fetch ( resolveUrl ( 'image-list.json' ) )
4349 if ( response . ok ) {
4450 const data = await response . json ( )
4551 const imageList : ImageData [ ] = data . images . map ( ( imageName : string ) => ( {
@@ -108,7 +114,7 @@ export default function Dashboard() {
108114 async function loadAnnotationsForImage ( imageId : string ) {
109115 setImageLoading ( true )
110116 try {
111- const response = await fetch ( `annotations/nsd/${ imageId } _annotations.json` )
117+ const response = await fetch ( resolveUrl ( `annotations/nsd/${ imageId } _annotations.json` ) )
112118 if ( response . ok ) {
113119 const data = await response . json ( )
114120 setAnnotations ( prev => ( { ...prev , [ imageId ] : data . annotations || [ ] } ) )
You can’t perform that action at this time.
0 commit comments