Skip to content

Commit

Permalink
Only query single route if segmentRange specified (#522)
Browse files Browse the repository at this point in the history
* fixed issue

* removed previous approach

* implemented possible fix

* fixed issue on login

* fixed logical error

* update comma-api

* stash

* fixed driveview not loading

* revert all to master

* toooooooo messy

* clean up

* more

* add comment

---------

Co-authored-by: Shane Smiskol <[email protected]>
  • Loading branch information
vishalkrishnads and sshane authored Jul 12, 2024
1 parent 396f0d6 commit 6600dfc
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 12 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
"node": ">=16"
},
"dependencies": {
"@commaai/api": "github:commaai/comma-api#3.1.2",
"@commaai/api": "github:commaai/comma-api#3.1.3",
"@commaai/my-comma-auth": "^1.4.1",
"@mapbox/mapbox-sdk": "^0.15.3",
"@material-ui/core": "^1.5.1",
Expand Down
10 changes: 5 additions & 5 deletions pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

18 changes: 12 additions & 6 deletions src/actions/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -32,10 +32,18 @@ export function checkRoutesData() {
const { dongleId } = state;
const fetchRange = state.filter;

routesRequest = {
req: Drives.getRoutesSegments(dongleId, fetchRange.start, fetchRange.end, state.limit),
dongleId,
};
// if requested segment range not in loaded routes, fetch it explicitly
if (state.segmentRange) {
routesRequest = {
req: Drives.getRoutesSegments(dongleId, undefined, undefined, undefined, `${dongleId}|${state.segmentRange.log_id}`),
dongleId,
};
} else {
routesRequest = {
req: Drives.getRoutesSegments(dongleId, fetchRange.start, fetchRange.end, state.limit),
dongleId,
};
}

routesRequestPromise = routesRequest.req.then((routesData) => {
state = getState();
Expand Down Expand Up @@ -148,8 +156,6 @@ export function urlForState(dongleId, log_id, start, end, prime) {
}

function updateTimeline(state, dispatch, log_id, start, end, allowPathChange) {
dispatch(checkRoutesData());

if (!state.loop || !state.loop.startTime || !state.loop.duration || state.loop.startTime < start
|| state.loop.startTime + state.loop.duration > end || state.loop.duration < end - start) {
dispatch(resetPlayback());
Expand Down

0 comments on commit 6600dfc

Please sign in to comment.