Skip to content

Commit 1a0a06d

Browse files
committed
fixed detail view
1 parent 040fd83 commit 1a0a06d

File tree

2 files changed

+15
-4
lines changed

2 files changed

+15
-4
lines changed

frontend/src/components/common/Game/Dialog/MatchRom.vue

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ import storeRoms, { type SimpleRom } from "@/stores/roms";
88
import type { Events } from "@/types/emitter";
99
import type { Emitter } from "mitt";
1010
import { inject, onBeforeUnmount, ref } from "vue";
11+
import { useRoute } from "vue-router";
1112
import { useDisplay, useTheme } from "vuetify";
1213
1314
type MatchedSource = {
@@ -21,6 +22,7 @@ const show = ref(false);
2122
const rom = ref<SimpleRom | null>(null);
2223
const romsStore = storeRoms();
2324
const searching = ref(false);
25+
const route = useRoute();
2426
const searchTerm = ref("");
2527
const theme = useTheme();
2628
const searchBy = ref("Name");
@@ -169,7 +171,10 @@ async function updateRom(selectedRom: SearchRomSchema) {
169171
icon: "mdi-check-bold",
170172
color: "green",
171173
});
172-
romsStore.update(data);
174+
romsStore.update(data as SimpleRom);
175+
if (route.name == "rom") {
176+
romsStore.currentRom = data;
177+
}
173178
})
174179
.catch((error) => {
175180
emitter?.emit("snackbarShow", {

frontend/src/views/GameDetails.vue

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ import type { Events } from "@/types/emitter";
2020
import type { Emitter } from "mitt";
2121
import { storeToRefs } from "pinia";
2222
import { inject, onBeforeMount, ref, watch } from "vue";
23-
import { useRoute } from "vue-router";
23+
import { onBeforeRouteLeave, useRoute } from "vue-router";
2424
import { useDisplay } from "vuetify";
2525
2626
// Props
@@ -82,6 +82,10 @@ onBeforeMount(async () => {
8282
downloadStore.clear();
8383
});
8484
85+
onBeforeRouteLeave(() => {
86+
currentRom.value = null;
87+
});
88+
8589
watch(
8690
() => route.fullPath,
8791
async () => {
@@ -180,8 +184,10 @@ watch(
180184
<v-window disabled v-model="tab" class="py-2">
181185
<v-window-item value="details">
182186
<v-row no-gutters :class="{ 'mx-2': mdAndUp }">
183-
<file-info :rom="currentRom" :platform="platform" />
184-
<game-info :rom="currentRom" />
187+
<v-col>
188+
<file-info :rom="currentRom" :platform="platform" />
189+
<game-info :rom="currentRom" />
190+
</v-col>
185191
</v-row>
186192
</v-window-item>
187193
<v-window-item value="saves">

0 commit comments

Comments
 (0)