@@ -11,7 +11,7 @@ import MainLayout from "../MainLayout"
1111import fetchAudioData from "../../utils/fetch-audio-data"
1212import fetchCSVData from "../../utils/fetch-csv-data"
1313
14- import validateTimeData from "../../utils/validate -time-data"
14+ import fixTimeData from "../../utils/fix -time-data"
1515
1616const emptyAr = [ ]
1717
@@ -52,13 +52,18 @@ export const ReactTimeSeriesWithoutContext = ({
5252
5353 const timeDataAvailable = [ sampleTimeData , audioUrl , csvUrl ] . some ( Boolean )
5454
55+ const [ error , setError ] = useState ( null )
5556 const timeData = useAsyncMemo (
5657 async ( ) => {
57- if ( sampleTimeData ) return validateTimeData ( sampleTimeData )
58- if ( audioUrl ) return validateTimeData ( await fetchAudioData ( audioUrl ) )
59- if ( csvUrl ) return validateTimeData ( await fetchCSVData ( csvUrl ) )
60- return [ ]
61- // TODO load csvUrl
58+ try {
59+ if ( sampleTimeData ) return fixTimeData ( sampleTimeData , graphs )
60+ if ( audioUrl ) return fixTimeData ( await fetchAudioData ( audioUrl ) , graphs )
61+ if ( csvUrl ) return fixTimeData ( await fetchCSVData ( csvUrl ) , graphs )
62+ return [ ]
63+ } catch ( e ) {
64+ setError ( e )
65+ return [ ]
66+ }
6267 } ,
6368 [ sampleTimeData , audioUrl , csvUrl ] ,
6469 null
@@ -200,6 +205,10 @@ export const ReactTimeSeriesWithoutContext = ({
200205 throw new Error ( `For some reason, no curves are able to be displayed.` )
201206 }
202207
208+ if ( error ) {
209+ throw error
210+ }
211+
203212 return (
204213 < Measure bounds onResize = { onResize } >
205214 { ( { measureRef } ) => (
0 commit comments