From 517b02478bb58c13aae3a63f1916e59f689a6a5a Mon Sep 17 00:00:00 2001 From: 0x7B5 Date: Tue, 25 Jun 2024 13:47:31 -0400 Subject: [PATCH 1/6] Fixing loop setting. --- src/actions/history.js | 8 ++++++-- src/reducers/globalState.js | 12 +++++------- 2 files changed, 11 insertions(+), 9 deletions(-) diff --git a/src/actions/history.js b/src/actions/history.js index b139baa1..78b860f1 100644 --- a/src/actions/history.js +++ b/src/actions/history.js @@ -36,10 +36,14 @@ export const onHistoryMiddleware = ({ dispatch, getState }) => (next) => async ( console.error('Error fetching routes data for log ID conversion', err); }); } - if (pathSegmentRange !== state.segmentRange) { - dispatch(pushTimelineRange(pathSegmentRange?.log_id, pathSegmentRange?.start, pathSegmentRange?.end, false)); + if (state.zoom.previous) { + console.log("yo"); + dispatch(pushTimelineRange(pathSegmentRange?.log_id, state.zoom?.previous.start, state.zoom?.previous.end, false)); + } else { + dispatch(pushTimelineRange(pathSegmentRange?.log_id, pathSegmentRange?.start, pathSegmentRange?.end, false)); + } } const pathPrimeNav = getPrimeNav(action.payload.location.pathname); diff --git a/src/reducers/globalState.js b/src/reducers/globalState.js index c09d3bc1..f3bfb2bb 100644 --- a/src/reducers/globalState.js +++ b/src/reducers/globalState.js @@ -299,6 +299,11 @@ export default function reducer(_state, action) { end: state.currentRoute.duration, previous: state.zoom, } + + state.loop = { + startTime: state.zoom.start, + duration: state.zoom.end - state.zoom.start, + }; } else { state.zoom = { start: action.start, @@ -311,13 +316,6 @@ export default function reducer(_state, action) { start: state.currentRoute.start_time_utc_millis, end: state.currentRoute.end_time_utc_millis, }; - - if (!state.loop) { - state.loop = { - startTime: state.zoom.start, - duration: state.zoom.end - state.zoom.start, - }; - } } else { state.zoom = null; state.loop = null; From 5e64d38cd25efa27d8f89761c5c7d51e3c8d1c89 Mon Sep 17 00:00:00 2001 From: 0x7B5 Date: Tue, 25 Jun 2024 13:48:37 -0400 Subject: [PATCH 2/6] Cleanup. --- src/actions/history.js | 1 - 1 file changed, 1 deletion(-) diff --git a/src/actions/history.js b/src/actions/history.js index 78b860f1..b0bb0cbd 100644 --- a/src/actions/history.js +++ b/src/actions/history.js @@ -39,7 +39,6 @@ export const onHistoryMiddleware = ({ dispatch, getState }) => (next) => async ( if (pathSegmentRange !== state.segmentRange) { if (state.zoom.previous) { - console.log("yo"); dispatch(pushTimelineRange(pathSegmentRange?.log_id, state.zoom?.previous.start, state.zoom?.previous.end, false)); } else { dispatch(pushTimelineRange(pathSegmentRange?.log_id, pathSegmentRange?.start, pathSegmentRange?.end, false)); From ae3a683488cce94f8c94b8c075cd092204b26c53 Mon Sep 17 00:00:00 2001 From: 0x7B5 Date: Tue, 25 Jun 2024 13:51:02 -0400 Subject: [PATCH 3/6] Fixed bug. --- src/actions/history.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/actions/history.js b/src/actions/history.js index b0bb0cbd..e121b6a4 100644 --- a/src/actions/history.js +++ b/src/actions/history.js @@ -38,7 +38,7 @@ export const onHistoryMiddleware = ({ dispatch, getState }) => (next) => async ( } if (pathSegmentRange !== state.segmentRange) { - if (state.zoom.previous) { + if (state.zoom?.previous) { dispatch(pushTimelineRange(pathSegmentRange?.log_id, state.zoom?.previous.start, state.zoom?.previous.end, false)); } else { dispatch(pushTimelineRange(pathSegmentRange?.log_id, pathSegmentRange?.start, pathSegmentRange?.end, false)); From 2b7a68ca116bdef3268df31cd6238a39d12af09b Mon Sep 17 00:00:00 2001 From: Shane Smiskol Date: Tue, 16 Jul 2024 13:39:51 -0700 Subject: [PATCH 4/6] revert this --- src/actions/history.js | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/src/actions/history.js b/src/actions/history.js index e121b6a4..b139baa1 100644 --- a/src/actions/history.js +++ b/src/actions/history.js @@ -36,13 +36,10 @@ export const onHistoryMiddleware = ({ dispatch, getState }) => (next) => async ( console.error('Error fetching routes data for log ID conversion', err); }); } + if (pathSegmentRange !== state.segmentRange) { - if (state.zoom?.previous) { - dispatch(pushTimelineRange(pathSegmentRange?.log_id, state.zoom?.previous.start, state.zoom?.previous.end, false)); - } else { - dispatch(pushTimelineRange(pathSegmentRange?.log_id, pathSegmentRange?.start, pathSegmentRange?.end, false)); - } + dispatch(pushTimelineRange(pathSegmentRange?.log_id, pathSegmentRange?.start, pathSegmentRange?.end, false)); } const pathPrimeNav = getPrimeNav(action.payload.location.pathname); From d54b17e349068698a764eae07f4a348c5dbde8c0 Mon Sep 17 00:00:00 2001 From: Shane Smiskol Date: Tue, 16 Jul 2024 13:52:00 -0700 Subject: [PATCH 5/6] same thing --- src/reducers/globalState.js | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/src/reducers/globalState.js b/src/reducers/globalState.js index feb45725..0d123825 100644 --- a/src/reducers/globalState.js +++ b/src/reducers/globalState.js @@ -307,10 +307,7 @@ export default function reducer(_state, action) { previous: state.zoom, } - state.loop = { - startTime: state.zoom.start, - duration: state.zoom.end - state.zoom.start, - }; + state.loop = null } else { state.zoom = { start: action.start, From cb1c58cdb3ee78b916cee039dbee6325ec785777 Mon Sep 17 00:00:00 2001 From: Shane Smiskol Date: Tue, 16 Jul 2024 13:54:43 -0700 Subject: [PATCH 6/6] comment --- src/reducers/globalState.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/reducers/globalState.js b/src/reducers/globalState.js index 0d123825..e0a394c3 100644 --- a/src/reducers/globalState.js +++ b/src/reducers/globalState.js @@ -307,7 +307,8 @@ export default function reducer(_state, action) { previous: state.zoom, } - state.loop = null + // fix loop on last zoom level + state.loop = null; } else { state.zoom = { start: action.start,