diff --git a/src/api/useVehicleLocations.ts b/src/api/useVehicleLocations.ts index 23323aa1..ae0c9711 100644 --- a/src/api/useVehicleLocations.ts +++ b/src/api/useVehicleLocations.ts @@ -166,16 +166,19 @@ export default function useVehicleLocations({ lineRef, operatorRef, splitMinutes: split = 1, + pause = false, }: { from: Dateable to: Dateable lineRef?: number operatorRef?: number splitMinutes?: false | number + pause?: boolean }) { const [locations, setLocations] = useState([]) const [isLoading, setIsLoading] = useState([]) useEffect(() => { + if (pause) return const range = split ? getMinutesInRange(from, to, split) : [{ from, to }] setIsLoading(range.map(() => true)) const unmounts = range.map(({ from, to }, i) => diff --git a/src/hooks/useSingleLineData.ts b/src/hooks/useSingleLineData.ts index c9991462..a9652d2f 100644 --- a/src/hooks/useSingleLineData.ts +++ b/src/hooks/useSingleLineData.ts @@ -18,7 +18,8 @@ export const useSingleLineData = (lineRef?: number, routeIds?: number[]) => { from: +new Date(timestamp).setHours(0, 0, 0, 0), to: +new Date(timestamp).setHours(23, 59, 59, 999), lineRef, - splitMinutes: 20, + splitMinutes: 60, + pause: !lineRef, }) const positions = useMemo(() => {