feat: select item on file list after navigating back (#5329)

This commit is contained in:
Ramires Viana
2025-07-27 08:03:00 -03:00
committed by GitHub
parent 25e47c3ce8
commit cbeec6d225
13 changed files with 143 additions and 79 deletions

View File

@@ -48,16 +48,15 @@ export default {
"selectedCount",
"req",
"selected",
"currentPrompt",
]),
...mapWritableState(useFileStore, ["reload"]),
...mapState(useLayoutStore, ["currentPrompt"]),
...mapWritableState(useFileStore, ["reload", "preselect"]),
},
methods: {
...mapActions(useLayoutStore, ["closeHovers"]),
submit: async function () {
buttons.loading("delete");
window.sessionStorage.setItem("modified", "true");
try {
if (!this.isListing) {
await api.remove(this.$route.path);
@@ -81,6 +80,12 @@ export default {
await Promise.all(promises);
buttons.success("delete");
const nearbyItem =
this.req.items[Math.max(0, Math.min(this.selected) - 1)];
this.preselect = nearbyItem?.path;
this.reload = true;
} catch (e) {
buttons.done("delete");