diff --git a/src/renderer/util.ts b/src/renderer/util.ts index b79a6ccc2..5818500e4 100644 --- a/src/renderer/util.ts +++ b/src/renderer/util.ts @@ -1,4 +1,4 @@ -import { React, channels, fluxDispatcher, guilds } from "@common"; +import { React, channels, flux, fluxDispatcher, guilds } from "@common"; import type { Fiber } from "react-reconciler"; import type { Jsonifiable } from "type-fest"; import type { ObjectExports } from "../types"; @@ -287,7 +287,17 @@ export function virtualMerge(...objects: O): ExtractObje if (method === "get" && args[0] === "all") { // Return function that returns all objects combined // For use in devtools to see everything available - return () => objects.reduce((acc, obj) => ({ ...acc, ...obj }), {}); + return () => + objects.reduce((acc: Record, obj: Record) => { + // Manually iterate over the property names of the object because the spread operator does not work with prototype objects, which are common for stores. + Object.getOwnPropertyNames(obj).forEach((key) => { + // Filter out keys that are common on all stores + if (!(obj instanceof flux.Store) || (key !== "initialize" && key !== "constructor")) { + acc[key] = obj[key]; + } + }); + return acc; + }, {}); } return Reflect[method]( findObjectByProp(args[0] as PropertyKey),