diff --git a/src/App.tsx b/src/App.tsx index 610f2f3..ec5f206 100644 --- a/src/App.tsx +++ b/src/App.tsx @@ -42,10 +42,10 @@ function App() { } async function onVolumeClick(mountpoint: string) { - if (pathHistory[pathHistory.length - 1] != mountpoint) { - pathHistory.push(mountpoint); - } - setHistoryPlace(pathHistory.length - 1); + pathHistory.splice(1); + pathHistory.push(mountpoint); + + setHistoryPlace(1); setCurrentVolume(mountpoint); await getNewDirectoryContents(); @@ -56,6 +56,7 @@ function App() { setSearchResults([]); } + pathHistory.splice(historyPlace + 1); pathHistory.push(filePath); setHistoryPlace(pathHistory.length - 1); diff --git a/src/hooks/useNavigation.ts b/src/hooks/useNavigation.ts index dfd7c72..a0385b9 100644 --- a/src/hooks/useNavigation.ts +++ b/src/hooks/useNavigation.ts @@ -17,7 +17,6 @@ export default function useNavigation( return; } - pathHistory.push(pathHistory[historyPlace - 1]); setHistoryPlace((prevPlace) => prevPlace - 1); }