From cc6a1799cc81dbcac135c943119e4e1121f2576f Mon Sep 17 00:00:00 2001 From: vishalkrishnads <321vishalds@gmail.com> Date: Wed, 26 Jun 2024 21:27:49 +0530 Subject: [PATCH] implemented possible fix --- src/actions/index.js | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/src/actions/index.js b/src/actions/index.js index 18d7c9c3..109603e8 100644 --- a/src/actions/index.js +++ b/src/actions/index.js @@ -37,7 +37,7 @@ export function checkRoutesData() { dongleId, }; - routesRequestPromise = routesRequest.req.then((routesData) => { + routesRequestPromise = routesRequest.req.then(async (routesData) => { state = getState(); const currentRange = state.filter; if (currentRange.start !== fetchRange.start @@ -53,6 +53,15 @@ export function checkRoutesData() { return; } + if (!state.currentRoute && state.segmentRange) { + const curr = routesData.find((route) => route.log_id === state.segmentRange.log_id); + if(!curr) { + await Drives.getRouteInfo(state.segmentRange.log_id) + .then(res => routesData.push(res)) + .catch(err => console.error(`Couldn't load route: ${err}`)) + } + } + const routes = routesData.map((r) => { let startTime = r.segment_start_times[0]; let endTime = r.segment_end_times[r.segment_end_times.length - 1];