diff --git a/frontend/src/App.vue b/frontend/src/App.vue index 9f08ae600..2d1304ddd 100644 --- a/frontend/src/App.vue +++ b/frontend/src/App.vue @@ -8,21 +8,20 @@ import socket from "@/services/socket"; import { onBeforeMount } from "vue"; import cookie from "js-cookie"; import storeGalleryFilter from "@/stores/galleryFilter"; -import storePlatforms, { type Platform } from "@/stores/platforms"; import storeRoms from "@/stores/roms"; import storeScanning from "@/stores/scanning"; import type { Events } from "@/types/emitter"; import { normalizeString } from "@/utils"; import type { Emitter } from "mitt"; import { storeToRefs } from "pinia"; -import { inject, onBeforeUnmount, ref } from "vue"; +import { inject, onBeforeUnmount } from "vue"; // Props const scanningStore = storeScanning(); const { scanningPlatforms } = storeToRefs(scanningStore); const romsStore = storeRoms(); const galleryFilter = storeGalleryFilter(); -const isFiltered = normalizeString(galleryFilter.filter).trim() != ""; +const isFiltered = normalizeString(galleryFilter.filterSearch).trim() != ""; const emitter = inject>("emitter"); // Props @@ -39,30 +38,41 @@ socket.on("scan:scanning_platform", ({ name, slug, id }) => { window.setTimeout(scrollToBottom, 100); }); -socket.on( - "scan:scanning_rom", - ({ platform_name, platform_slug, ...rom }) => { - romsStore.add([rom]); - if (isFiltered) { - romsStore.setFiltered(romsStore.filteredRoms); - } else { - romsStore.setFiltered(romsStore.allRoms); - } - - let scannedPlatform = scanningPlatforms.value.find( - (p) => p.slug === platform_slug +socket.on("scan:scanning_rom", ({ platform_name, platform_slug, ...rom }) => { + romsStore.add([rom]); + if (isFiltered) { + romsStore.setFiltered( + romsStore.filteredRoms, + galleryFilter.filterUnmatched, + galleryFilter.selectedGenre, + galleryFilter.selectedFranchise, + galleryFilter.selectedCollection, + galleryFilter.selectedCompany + ); + } else { + romsStore.setFiltered( + romsStore.allRoms, + galleryFilter.filterUnmatched, + galleryFilter.selectedGenre, + galleryFilter.selectedFranchise, + galleryFilter.selectedCollection, + galleryFilter.selectedCompany ); - - // Add the platform if the socket dropped and it's missing - if (scannedPlatform) { - scanningPlatforms.value.push(scannedPlatform); - scannedPlatform = scanningPlatforms.value.pop(); - } - - scannedPlatform?.roms.push(rom); - window.setTimeout(scrollToBottom, 100); } -); + + let scannedPlatform = scanningPlatforms.value.find( + (p) => p.slug === platform_slug + ); + + // Add the platform if the socket dropped and it's missing + if (scannedPlatform) { + scanningPlatforms.value.push(scannedPlatform); + scannedPlatform = scanningPlatforms.value.pop(); + } + + scannedPlatform?.roms.push(rom); + window.setTimeout(scrollToBottom, 100); +}); socket.on("scan:done", () => { scanningStore.set(false); diff --git a/frontend/src/components/Gallery/AppBar/Base.vue b/frontend/src/components/Gallery/AppBar/Base.vue index f34fae9e2..2581a5d8a 100644 --- a/frontend/src/components/Gallery/AppBar/Base.vue +++ b/frontend/src/components/Gallery/AppBar/Base.vue @@ -15,9 +15,8 @@ const auth = storeAuth(); diff --git a/frontend/src/components/Gallery/AppBar/DeleteBtn.vue b/frontend/src/components/Gallery/AppBar/DeleteBtn.vue index 3b28872e4..819757697 100644 --- a/frontend/src/components/Gallery/AppBar/DeleteBtn.vue +++ b/frontend/src/components/Gallery/AppBar/DeleteBtn.vue @@ -1,22 +1,19 @@