Fix #1283 - properly default groupRoms if it doesn't exist in localStorage

This commit is contained in:
Matt Weinecke
2024-11-10 10:38:15 -08:00
parent a27404c17b
commit ba73e38310

View File

@@ -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;