File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -63,18 +63,7 @@ export function useInstrumentVisualization({ params }: UseInstrumentVisualizatio
6363 }
6464 } ) ;
6565
66- // Create a new sessionsUsernameQuery which uses the useFindSessionQuery hook
67- // have use a different return type with
68-
69- const userInfo = async ( userId : string ) : Promise < null | User > => {
70- try {
71- const response = await axios . get ( `/v1/users/${ userId } ` ) ;
72- return response . data ? ( response . data as User ) : null ;
73- } catch ( error ) {
74- console . error ( 'Error fetching user:' , error ) ;
75- return null ; // ensures a resolved value instead of `void`
76- }
77- } ;
66+
7867
7968 const dl = ( option : 'CSV' | 'CSV Long' | 'Excel' | 'Excel Long' | 'JSON' | 'TSV' | 'TSV Long' ) => {
8069 if ( ! instrument ) {
@@ -250,7 +239,9 @@ export function useInstrumentVisualization({ params }: UseInstrumentVisualizatio
250239 } ;
251240 } ) ;
252241
253- setRecords ( records ) ;
242+ if ( ! cancelled ) {
243+ setRecords ( records ) ;
244+ }
254245 }
255246 } catch ( error ) {
256247 console . error ( 'Error occurred: ' , error ) ;
@@ -264,6 +255,9 @@ export function useInstrumentVisualization({ params }: UseInstrumentVisualizatio
264255 }
265256 } ;
266257 void fetchRecords ( ) ;
258+ return ( ) => {
259+ cancelled = true ;
260+ } ;
267261 } , [ recordsQuery . data ] ) ;
268262
269263 const instrumentOptions : { [ key : string ] : string } = useMemo ( ( ) => {
You can’t perform that action at this time.
0 commit comments