diff --git a/frontend/src/components/common/Game/AdminMenu.vue b/frontend/src/components/common/Game/AdminMenu.vue index 6647e3517..bf04f389f 100644 --- a/frontend/src/components/common/Game/AdminMenu.vue +++ b/frontend/src/components/common/Game/AdminMenu.vue @@ -55,7 +55,9 @@ async function switchFromFavourites() { favCollection.value.roms = favCollection.value.roms.filter( (id) => id !== props.rom.id ); - romsStore.remove([props.rom]); + if (romsStore.currentCollection?.name.toLowerCase() == "favourites") { + romsStore.remove([props.rom]); + } } } await collectionApi diff --git a/frontend/src/components/common/Game/FavBtn.vue b/frontend/src/components/common/Game/FavBtn.vue index 9aab5fd5c..5ca2e32bf 100644 --- a/frontend/src/components/common/Game/FavBtn.vue +++ b/frontend/src/components/common/Game/FavBtn.vue @@ -51,7 +51,9 @@ async function switchFromFavourites() { favCollection.value.roms = favCollection.value.roms.filter( (id) => id !== props.rom.id ); - romsStore.remove([props.rom]); + if (romsStore.currentCollection?.name.toLowerCase() == "favourites") { + romsStore.remove([props.rom]); + } } } await collectionApi diff --git a/frontend/src/stores/roms.ts b/frontend/src/stores/roms.ts index 583e21314..073a9e5a1 100644 --- a/frontend/src/stores/roms.ts +++ b/frontend/src/stores/roms.ts @@ -92,7 +92,7 @@ export default defineStore("roms", { return a.sort_comparator.localeCompare(b.sort_comparator); }); }, - setCurrentPlatform(platform: Platform) { + setCurrentPlatform(platform: Platform | null) { this.currentPlatform = platform; }, setCurrentRom(rom: DetailedRom) { @@ -101,7 +101,7 @@ export default defineStore("roms", { setRecentRoms(roms: SimpleRom[]) { this.recentRoms = roms; }, - setCurrentCollection(collection: Collection) { + setCurrentCollection(collection: Collection | null) { this.currentCollection = collection; }, set(roms: SimpleRom[]) { diff --git a/frontend/src/views/Gallery/Collection.vue b/frontend/src/views/Gallery/Collection.vue index 4eb70af1e..5117b3122 100644 --- a/frontend/src/views/Gallery/Collection.vue +++ b/frontend/src/views/Gallery/Collection.vue @@ -245,6 +245,7 @@ onBeforeRouteUpdate(async (to, from) => { }); onBeforeUnmount(() => { + romsStore.setCurrentCollection(null); window.removeEventListener("wheel", onScroll); window.removeEventListener("scroll", onScroll); }); diff --git a/frontend/src/views/Gallery/Platform.vue b/frontend/src/views/Gallery/Platform.vue index 0b3cd864b..a078b4daf 100644 --- a/frontend/src/views/Gallery/Platform.vue +++ b/frontend/src/views/Gallery/Platform.vue @@ -245,6 +245,7 @@ onBeforeRouteUpdate(async (to, from) => { }); onBeforeUnmount(() => { + romsStore.setCurrentPlatform(null); window.removeEventListener("wheel", onScroll); window.removeEventListener("scroll", onScroll); });