From ba73e38310ba2fefcc6a458c294e09101e6352a3 Mon Sep 17 00:00:00 2001 From: Matt Weinecke <748754+MattTW@users.noreply.github.com> Date: Sun, 10 Nov 2024 10:38:15 -0800 Subject: [PATCH] Fix #1283 - properly default groupRoms if it doesn't exist in localStorage --- frontend/src/stores/roms.ts | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/frontend/src/stores/roms.ts b/frontend/src/stores/roms.ts index ba20a097e..453067920 100644 --- a/frontend/src/stores/roms.ts +++ b/frontend/src/stores/roms.ts @@ -3,7 +3,7 @@ import type { DetailedRomSchema, SimpleRomSchema } from "@/__generated__/"; import { type Platform } from "@/stores/platforms"; import { type Collection } from "@/stores/collections"; import type { ExtractPiniaStoreType } from "@/types"; -import { groupBy, uniqBy } from "lodash"; +import { groupBy, isNull, uniqBy } from "lodash"; import { nanoid } from "nanoid"; import { defineStore } from "pinia"; import storeGalleryFilter from "./galleryFilter"; @@ -47,7 +47,9 @@ export default defineStore("roms", { }); // Check if roms should be grouped - const groupRoms = localStorage.getItem("settings.groupRoms") === "true"; + const groupRoms = isNull(localStorage.getItem("settings.groupRoms")) + ? true + : localStorage.getItem("settings.groupRoms") === "true"; if (!groupRoms) { this._grouped = this.allRoms; return;