diff --git a/ui/component/buttonNavigation/view.jsx b/ui/component/buttonNavigation/view.jsx
index 0399ea0a4..df5e115a2 100644
--- a/ui/component/buttonNavigation/view.jsx
+++ b/ui/component/buttonNavigation/view.jsx
@@ -17,56 +17,58 @@ type Props = {
},
};
+// determines which slice of entries should make up the back or forward button drop-downs (isBackward vs !isBackward respectively)
+const sliceEntries = (currentIndex, entries, historyLength, isBackward) => {
+ const l = isBackward ? 0 : currentIndex + 1;
+ const r = isBackward ? currentIndex : historyLength;
+ return entries.slice(l, r);
+};
+
const ButtonNavigation = (props: Props) => {
const { isBackward, history } = props;
+ const { entries, go } = history;
+ const currentIndex = history.index;
+ const historyLength = history.length;
const [showHistory, setShowHistory] = useState(false);
- const makeEntrySlice = useCallback(() => {
- const left = isBackward ? 1 : history.index + 1;
- const right = isBackward ? history.index : history.length;
- return history.entries.slice(left, right);
- }, [history, isBackward]);
-
+ // creates an
intended for the button's
const makeItem = useCallback(
(entry, index) => {
- const goArg = isBackward ? index - history.index : history.index - index;
- console.log(`index: ${index}, currentIndex: ${history.index}, goArg: ${goArg}, title: ${entry.title}`);
+ // difference between the current index and the index of the entry
+ const goArg = isBackward ? index - currentIndex : index + 1;
return (