From 49fcade37433d31236602c1977d22b21918f4cd1 Mon Sep 17 00:00:00 2001 From: vishalkrishnads <321vishalds@gmail.com> Date: Thu, 20 Jun 2024 13:06:15 +0530 Subject: [PATCH] fixed issue --- src/actions/index.js | 11 +++++------ src/actions/startup.js | 2 +- 2 files changed, 6 insertions(+), 7 deletions(-) diff --git a/src/actions/index.js b/src/actions/index.js index 3aa46f5e..aa1828f7 100644 --- a/src/actions/index.js +++ b/src/actions/index.js @@ -6,7 +6,7 @@ import MyCommaAuth from '@commaai/my-comma-auth'; import * as Types from './types'; import { resetPlayback, selectLoop } from '../timeline/playback'; -import {hasRoutesData } from '../timeline/segments'; +import { hasRoutesData } from '../timeline/segments'; import { getDeviceFromState, deviceVersionAtLeast } from '../utils'; let routesRequest = null; @@ -60,7 +60,7 @@ export function checkRoutesData() { // TODO: these will all be relative times soon // fix segment boundary times for routes that have the wrong time at the start if ((Math.abs(r.start_time_utc_millis - startTime) > 24 * 60 * 60 * 1000) - && (Math.abs(r.end_time_utc_millis - endTime) < 10 * 1000)) { + && (Math.abs(r.end_time_utc_millis - endTime) < 10 * 1000)) { console.log('fixing %s', r.fullname); startTime = r.start_time_utc_millis; endTime = r.end_time_utc_millis; @@ -102,7 +102,7 @@ export function checkRoutesData() { }; } -export function checkLastRoutesData() { +export function checkLastRoutesData(loadAll = false) { return (dispatch, getState) => { const limit = getState().limit const routes = getState().routes @@ -112,10 +112,9 @@ export function checkLastRoutesData() { return } - console.log(`fetching ${limit +LIMIT_INCREMENT } routes`) dispatch({ type: Types.ACTION_UPDATE_ROUTE_LIMIT, - limit: limit + LIMIT_INCREMENT, + limit: loadAll ? null : limit + LIMIT_INCREMENT, }) const d = new Date(); @@ -158,7 +157,7 @@ function updateTimeline(state, dispatch, log_id, start, end, allowPathChange) { } if (allowPathChange) { - const desiredPath = urlForState(state.dongleId, log_id, Math.floor(start/1000), Math.floor(end/1000), false); + const desiredPath = urlForState(state.dongleId, log_id, Math.floor(start / 1000), Math.floor(end / 1000), false); if (window.location.pathname !== desiredPath) { dispatch(push(desiredPath)); } diff --git a/src/actions/startup.js b/src/actions/startup.js index 66901080..4c310314 100644 --- a/src/actions/startup.js +++ b/src/actions/startup.js @@ -42,7 +42,7 @@ export default function init() { return async (dispatch, getState) => { let state = getState(); if (state.dongleId && !state.routes) { - dispatch(checkLastRoutesData()); + dispatch(checkLastRoutesData(/^\/[^/]+\/[^/]+$/.test(window.location.pathname))); } const [profile, devices] = await Promise.all([initProfile(), initDevices()]);