File tree Expand file tree Collapse file tree 2 files changed +15
-4
lines changed
components/common/Game/Dialog Expand file tree Collapse file tree 2 files changed +15
-4
lines changed Original file line number Diff line number Diff line change @@ -8,6 +8,7 @@ import storeRoms, { type SimpleRom } from "@/stores/roms";
8
8
import type { Events } from " @/types/emitter" ;
9
9
import type { Emitter } from " mitt" ;
10
10
import { inject , onBeforeUnmount , ref } from " vue" ;
11
+ import { useRoute } from " vue-router" ;
11
12
import { useDisplay , useTheme } from " vuetify" ;
12
13
13
14
type MatchedSource = {
@@ -21,6 +22,7 @@ const show = ref(false);
21
22
const rom = ref <SimpleRom | null >(null );
22
23
const romsStore = storeRoms ();
23
24
const searching = ref (false );
25
+ const route = useRoute ();
24
26
const searchTerm = ref (" " );
25
27
const theme = useTheme ();
26
28
const searchBy = ref (" Name" );
@@ -169,7 +171,10 @@ async function updateRom(selectedRom: SearchRomSchema) {
169
171
icon: " mdi-check-bold" ,
170
172
color: " green" ,
171
173
});
172
- romsStore .update (data );
174
+ romsStore .update (data as SimpleRom );
175
+ if (route .name == " rom" ) {
176
+ romsStore .currentRom = data ;
177
+ }
173
178
})
174
179
.catch ((error ) => {
175
180
emitter ?.emit (" snackbarShow" , {
Original file line number Diff line number Diff line change @@ -20,7 +20,7 @@ import type { Events } from "@/types/emitter";
20
20
import type { Emitter } from " mitt" ;
21
21
import { storeToRefs } from " pinia" ;
22
22
import { inject , onBeforeMount , ref , watch } from " vue" ;
23
- import { useRoute } from " vue-router" ;
23
+ import { onBeforeRouteLeave , useRoute } from " vue-router" ;
24
24
import { useDisplay } from " vuetify" ;
25
25
26
26
// Props
@@ -82,6 +82,10 @@ onBeforeMount(async () => {
82
82
downloadStore .clear ();
83
83
});
84
84
85
+ onBeforeRouteLeave (() => {
86
+ currentRom .value = null ;
87
+ });
88
+
85
89
watch (
86
90
() => route .fullPath ,
87
91
async () => {
@@ -180,8 +184,10 @@ watch(
180
184
<v-window disabled v-model =" tab" class =" py-2" >
181
185
<v-window-item value =" details" >
182
186
<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 >
185
191
</v-row >
186
192
</v-window-item >
187
193
<v-window-item value =" saves" >
You can’t perform that action at this time.
0 commit comments