Skip to content

Commit

Permalink
fix: filter virtualMerge keys only if its a store
Browse files Browse the repository at this point in the history
  • Loading branch information
FedeIlLeone committed Nov 13, 2024
1 parent 7e3b48a commit ac7932b
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 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 @@ -292,7 +292,9 @@ export function virtualMerge<O extends ObjectType[]>(...objects: O): ExtractObje
// 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 (key !== "initialize" && key !== "constructor") acc[key] = obj[key];
if (!(obj instanceof flux.Store) || (key !== "initialize" && key !== "constructor")) {
acc[key] = obj[key];
}
});
return acc;
}, {});
Expand Down

0 comments on commit ac7932b

Please sign in to comment.