Skip to content

Commit

Permalink
Fix random route popping up on scrolls (#523)
Browse files Browse the repository at this point in the history
* Fix random route on scroll.

* Linting error.

---------

Co-authored-by: Shane Smiskol <shane@smiskol.com>
  • Loading branch information
0x7B5 and sshane authored Jun 24, 2024
1 parent f59f6f8 commit 396f0d6
Showing 1 changed file with 11 additions and 5 deletions.
16 changes: 11 additions & 5 deletions src/reducers/globalState.js
Original file line number Diff line number Diff line change
Expand Up @@ -292,6 +292,11 @@ export default function reducer(_state, action) {
if (!state.zoom || !action.start || !action.end || action.start < state.zoom.start || action.end > state.zoom.end) {
state.files = null;
}

if (!action.log_id) {
state.segmentRange = null;
}

const r = state.routes?.find((route) => route.log_id === action.log_id);
if (action.log_id && r) {
state.currentRoute = r;
Expand Down Expand Up @@ -416,12 +421,13 @@ export default function reducer(_state, action) {
case Types.ACTION_UPDATE_SEGMENT_RANGE: {
if (!action.log_id) {
state.segmentRange = null;
} else {
state.segmentRange = {
log_id: action.log_id,
start: action.start,
end: action.end,
};
}
state.segmentRange = {
log_id: action.log_id,
start: action.start,
end: action.end,
};
break;
}
default:
Expand Down

0 comments on commit 396f0d6

Please sign in to comment.