Skip to content

Commit 6bf385a

Browse files
committed
fix pr
1 parent dd1921b commit 6bf385a

1 file changed

Lines changed: 26 additions & 26 deletions

File tree

src/pages/historicTimeline/index.tsx

Lines changed: 26 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ const TimelinePage = () => {
3838

3939
const time = useMemo(() => dayjs(search.timestamp), [timestamp])
4040

41-
const routesQueary = useQuery({
41+
const routesQuery = useQuery({
4242
queryFn: async () => {
4343
if (operatorId && lineNumber) {
4444
try {
@@ -53,14 +53,14 @@ const TimelinePage = () => {
5353
}
5454
return null
5555
},
56-
queryKey: ['routes', operatorId, lineNumber, time],
56+
queryKey: ['routes', operatorId, lineNumber, time.valueOf()],
5757
})
5858

5959
const selectedRoute = useMemo(() => {
60-
return routesQueary.data?.find((route) => route.key === routeKey)
61-
}, [routesQueary.data, routeKey])
60+
return routesQuery.data?.find((route) => route.key === routeKey)
61+
}, [routesQuery.data, routeKey])
6262

63-
const stopsQueary = useQuery({
63+
const stopsQuery = useQuery({
6464
queryFn: async () => {
6565
if (selectedRoute) {
6666
try {
@@ -72,14 +72,14 @@ const TimelinePage = () => {
7272
}
7373
return null
7474
},
75-
queryKey: ['stops', selectedRoute?.lineRef, time],
75+
queryKey: ['stops', selectedRoute?.lineRef, time.valueOf()],
7676
})
7777

7878
const selectedStop = useMemo(() => {
79-
return stopsQueary.data?.find((stop) => stop.key === stopKey)
80-
}, [stopsQueary.data, stopKey])
79+
return stopsQuery.data?.find((stop) => stop.key === stopKey)
80+
}, [stopsQuery.data, stopKey])
8181

82-
const hitsQueary = useQuery({
82+
const hitsQuery = useQuery({
8383
queryFn: async () => {
8484
if (selectedStop && selectedRoute) {
8585
const [gtfsTime, siriTime] = await Promise.all([
@@ -90,7 +90,7 @@ const TimelinePage = () => {
9090
}
9191
return null
9292
},
93-
queryKey: ['hits', selectedRoute?.lineRef, selectedStop?.stopId, time],
93+
queryKey: ['hits', selectedRoute?.lineRef, selectedStop?.stopId, time.valueOf()],
9494
})
9595

9696
return (
@@ -101,9 +101,9 @@ const TimelinePage = () => {
101101
<Alert severity="info" variant="outlined" icon={false}>
102102
{t('timeline_page_description')}
103103
</Alert>
104-
{hitsQueary.data &&
105-
hitsQueary.data.gtfsTime.length > 0 &&
106-
hitsQueary.data.siriTime.length === 0 && (
104+
{hitsQuery.data &&
105+
hitsQuery.data.gtfsTime.length > 0 &&
106+
hitsQuery.data.siriTime.length === 0 && (
107107
<Alert severity="warning" variant="outlined">
108108
{t('no_data_from_ETL')}
109109
</Alert>
@@ -159,50 +159,50 @@ const TimelinePage = () => {
159159
<Grid container size={{ lg: 4, md: 6, xs: 12 }}>
160160
<Row style={{ width: '100%' }}>
161161
<div style={{ width: '100%' }}>
162-
{routesQueary.data?.length === 0 ? (
162+
{routesQuery.data?.length === 0 ? (
163163
<NotFound>{t('line_not_found')}</NotFound>
164164
) : (
165165
<RouteSelector
166-
disabled={!routesQueary.data}
167-
routes={routesQueary.data || []}
166+
disabled={!routesQuery.data}
167+
routes={routesQuery.data || []}
168168
routeKey={routeKey}
169169
setRouteKey={(key) => setSearch((current) => ({ ...current, routeKey: key }))}
170170
/>
171171
)}
172172
</div>
173-
{routesQueary.isLoading && <CircularProgress />}
173+
{routesQuery.isLoading && <CircularProgress />}
174174
</Row>
175175
</Grid>
176176
{/* stops */}
177177
<Grid container size={{ lg: 4, md: 6, xs: 12 }}>
178178
<Row style={{ width: '100%' }}>
179179
<div style={{ width: '100%' }}>
180180
<StopSelector
181-
disabled={!stopsQueary.data}
182-
stops={stopsQueary.data || []}
181+
disabled={!stopsQuery.data}
182+
stops={stopsQuery.data || []}
183183
stopKey={stopKey}
184184
setStopKey={(key) => setStopKey(key)}
185185
/>
186186
</div>
187-
{stopsQueary.isLoading && <CircularProgress />}
187+
{stopsQuery.isLoading && <CircularProgress />}
188188
</Row>
189189
</Grid>
190190
{/* hits timeline */}
191191
{selectedRoute && selectedStop && (
192192
<Widget marginBottom>
193-
{hitsQueary.isLoading && (
193+
{hitsQuery.isLoading && (
194194
<Row>
195195
<Label text={t('loading_hits')} />
196196
<CircularProgress />
197197
</Row>
198198
)}
199-
{!hitsQueary.isLoading &&
200-
((hitsQueary.data?.gtfsTime && hitsQueary.data.gtfsTime.length > 0) ||
201-
(hitsQueary.data?.siriTime && hitsQueary.data.siriTime.length > 0) ? (
199+
{!hitsQuery.isLoading &&
200+
((hitsQuery.data?.gtfsTime && hitsQuery.data.gtfsTime.length > 0) ||
201+
(hitsQuery.data?.siriTime && hitsQuery.data.siriTime.length > 0) ? (
202202
<StyledTimelineBoard
203203
target={dayjs(timestamp)}
204-
gtfsTimes={hitsQueary.data.gtfsTime}
205-
siriTimes={hitsQueary.data.siriTime}
204+
gtfsTimes={hitsQuery.data.gtfsTime}
205+
siriTimes={hitsQuery.data.siriTime}
206206
/>
207207
) : (
208208
<NotFound>{t('hits_not_found')}</NotFound>

0 commit comments

Comments
 (0)