Skip to content

Commit

Permalink
refactor: simplify property update handling in Inspector
Browse files Browse the repository at this point in the history
  • Loading branch information
wouterlucas committed Nov 5, 2024
1 parent 74b6b7b commit a0d9bc1
Showing 1 changed file with 2 additions and 8 deletions.
10 changes: 2 additions & 8 deletions src/main-api/Inspector.ts
Original file line number Diff line number Diff line change
Expand Up @@ -270,13 +270,6 @@ export class Inspector {
node: CoreNode | CoreTextNode,
div: HTMLElement,
): CoreNode | CoreTextNode {
const updateNodePropertyWrapper = (
property: keyof CoreNodeProps,
value: any,
) => {
queueMicrotask(() => this.updateNodeProperty(div, property, value));
};

// Define traps for each property in knownProperties
knownProperties.forEach((property) => {
const originalProp = Object.getOwnPropertyDescriptor(node, property);
Expand All @@ -292,7 +285,8 @@ export class Inspector {
},
set(value) {
originalProp.set?.call(node, value);
updateNodePropertyWrapper(property as keyof CoreNodeProps, value);
// eslint-disable-next-line @typescript-eslint/no-unsafe-member-access, @typescript-eslint/no-unsafe-call
this.updateNodeProperty(div, property, value);
},
configurable: true,
enumerable: true,
Expand Down

0 comments on commit a0d9bc1

Please sign in to comment.