Skip to content

Commit

Permalink
implemented possible fix
Browse files Browse the repository at this point in the history
  • Loading branch information
vishalkrishnads committed Jun 26, 2024
1 parent 08121d4 commit cc6a179
Showing 1 changed file with 10 additions and 1 deletion.
11 changes: 10 additions & 1 deletion src/actions/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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];
Expand Down

0 comments on commit cc6a179

Please sign in to comment.