mirror of
https://github.com/rommapp/romm.git
synced 2026-11-29 10:01:00 +01:00
make favourites collection reactive
This commit is contained in:
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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[]) {
|
||||
|
||||
@@ -245,6 +245,7 @@ onBeforeRouteUpdate(async (to, from) => {
|
||||
});
|
||||
|
||||
onBeforeUnmount(() => {
|
||||
romsStore.setCurrentCollection(null);
|
||||
window.removeEventListener("wheel", onScroll);
|
||||
window.removeEventListener("scroll", onScroll);
|
||||
});
|
||||
|
||||
@@ -245,6 +245,7 @@ onBeforeRouteUpdate(async (to, from) => {
|
||||
});
|
||||
|
||||
onBeforeUnmount(() => {
|
||||
romsStore.setCurrentPlatform(null);
|
||||
window.removeEventListener("wheel", onScroll);
|
||||
window.removeEventListener("scroll", onScroll);
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user