Skip to content

Commit

Permalink
Replace location on self-rename
Browse files Browse the repository at this point in the history
If we rename our current directory, then instead of navigating to a new
directory in the usual way (creating a new history item), replace the
current item.

This avoids the back button returning to the old name of the directory
(which no longer exists).
  • Loading branch information
allisonkarlitskaya committed Feb 5, 2024
1 parent 72163cb commit 3950d89
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/apis/spawnHelpers.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ export const spawnRenameItem = ({ selected, name, path, Dialogs, setErrorMessage
cockpit.spawn(renameCommand({ selected, path, name }), options)
.then(() => {
if (selected.items_cnt) {
cockpit.location.go("/", { path: encodeURIComponent(newPath) });
cockpit.location.replace("/", { path: encodeURIComponent(newPath) });
}
Dialogs.close();
}, err => setErrorMessage(err.message));
Expand Down

0 comments on commit 3950d89

Please sign in to comment.