Skip to content

Commit

Permalink
Merge branch 'main' into replugged.app.asar
Browse files Browse the repository at this point in the history
  • Loading branch information
yofukashino authored Nov 13, 2024
2 parents f46375c + 5afc587 commit b9be646
Showing 1 changed file with 12 additions and 2 deletions.
14 changes: 12 additions & 2 deletions src/renderer/util.ts
Original file line number Diff line number Diff line change
@@ -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";
Expand Down Expand Up @@ -287,7 +287,17 @@ export function virtualMerge<O extends ObjectType[]>(...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<string, unknown>, obj: Record<string, unknown>) => {
// 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),
Expand Down

0 comments on commit b9be646

Please sign in to comment.