8
8
RealtimeRunSkipColumns ,
9
9
} from "@trigger.dev/core/v3" ;
10
10
import { useCallback , useEffect , useId , useRef , useState } from "react" ;
11
- import { KeyedMutator , useSWR } from "../utils/trigger-swr.js" ;
11
+ import { KeyedMutator , useInternalSWR } from "../utils/trigger-swr.js" ;
12
12
import { useApiClient , UseApiClientOptions } from "./useApiClient.js" ;
13
13
import { createThrottledQueue } from "../utils/throttle.js" ;
14
14
@@ -78,15 +78,15 @@ export function useRealtimeRun<TTask extends AnyTask>(
78
78
const idKey = options ?. id ?? hookId ;
79
79
80
80
// Store the streams state in SWR, using the idKey as the key to share states.
81
- const { data : run , mutate : mutateRun } = useSWR < RealtimeRun < TTask > > ( [ idKey , "run" ] , null ) ;
81
+ const { data : run , mutate : mutateRun } = useInternalSWR < RealtimeRun < TTask > > ( [ idKey , "run" ] , null ) ;
82
82
83
- const { data : error = undefined , mutate : setError } = useSWR < undefined | Error > (
83
+ const { data : error = undefined , mutate : setError } = useInternalSWR < undefined | Error > (
84
84
[ idKey , "error" ] ,
85
85
null
86
86
) ;
87
87
88
88
// Add state to track when the subscription is complete
89
- const { data : isComplete = false , mutate : setIsComplete } = useSWR < boolean > (
89
+ const { data : isComplete = false , mutate : setIsComplete } = useInternalSWR < boolean > (
90
90
[ idKey , "complete" ] ,
91
91
null
92
92
) ;
@@ -224,7 +224,7 @@ export function useRealtimeRunWithStreams<
224
224
const [ initialStreamsFallback ] = useState ( { } as StreamResults < TStreams > ) ;
225
225
226
226
// Store the streams state in SWR, using the idKey as the key to share states.
227
- const { data : streams , mutate : mutateStreams } = useSWR < StreamResults < TStreams > > (
227
+ const { data : streams , mutate : mutateStreams } = useInternalSWR < StreamResults < TStreams > > (
228
228
[ idKey , "streams" ] ,
229
229
null ,
230
230
{
@@ -239,15 +239,15 @@ export function useRealtimeRunWithStreams<
239
239
} , [ streams ] ) ;
240
240
241
241
// Store the streams state in SWR, using the idKey as the key to share states.
242
- const { data : run , mutate : mutateRun } = useSWR < RealtimeRun < TTask > > ( [ idKey , "run" ] , null ) ;
242
+ const { data : run , mutate : mutateRun } = useInternalSWR < RealtimeRun < TTask > > ( [ idKey , "run" ] , null ) ;
243
243
244
244
// Add state to track when the subscription is complete
245
- const { data : isComplete = false , mutate : setIsComplete } = useSWR < boolean > (
245
+ const { data : isComplete = false , mutate : setIsComplete } = useInternalSWR < boolean > (
246
246
[ idKey , "complete" ] ,
247
247
null
248
248
) ;
249
249
250
- const { data : error = undefined , mutate : setError } = useSWR < undefined | Error > (
250
+ const { data : error = undefined , mutate : setError } = useInternalSWR < undefined | Error > (
251
251
[ idKey , "error" ] ,
252
252
null
253
253
) ;
@@ -401,7 +401,7 @@ export function useRealtimeRunsWithTag<TTask extends AnyTask>(
401
401
const idKey = options ?. id ?? hookId ;
402
402
403
403
// Store the streams state in SWR, using the idKey as the key to share states.
404
- const { data : runs , mutate : mutateRuns } = useSWR < RealtimeRun < TTask > [ ] > ( [ idKey , "run" ] , null , {
404
+ const { data : runs , mutate : mutateRuns } = useInternalSWR < RealtimeRun < TTask > [ ] > ( [ idKey , "run" ] , null , {
405
405
fallbackData : [ ] ,
406
406
} ) ;
407
407
@@ -411,7 +411,7 @@ export function useRealtimeRunsWithTag<TTask extends AnyTask>(
411
411
runsRef . current = runs ?? [ ] ;
412
412
} , [ runs ] ) ;
413
413
414
- const { data : error = undefined , mutate : setError } = useSWR < undefined | Error > (
414
+ const { data : error = undefined , mutate : setError } = useInternalSWR < undefined | Error > (
415
415
[ idKey , "error" ] ,
416
416
null
417
417
) ;
@@ -499,7 +499,7 @@ export function useRealtimeBatch<TTask extends AnyTask>(
499
499
const idKey = options ?. id ?? hookId ;
500
500
501
501
// Store the streams state in SWR, using the idKey as the key to share states.
502
- const { data : runs , mutate : mutateRuns } = useSWR < RealtimeRun < TTask > [ ] > ( [ idKey , "run" ] , null , {
502
+ const { data : runs , mutate : mutateRuns } = useInternalSWR < RealtimeRun < TTask > [ ] > ( [ idKey , "run" ] , null , {
503
503
fallbackData : [ ] ,
504
504
} ) ;
505
505
@@ -509,7 +509,7 @@ export function useRealtimeBatch<TTask extends AnyTask>(
509
509
runsRef . current = runs ?? [ ] ;
510
510
} , [ runs ] ) ;
511
511
512
- const { data : error = undefined , mutate : setError } = useSWR < undefined | Error > (
512
+ const { data : error = undefined , mutate : setError } = useInternalSWR < undefined | Error > (
513
513
[ idKey , "error" ] ,
514
514
null
515
515
) ;
0 commit comments