mirror of
https://github.com/excalidraw/excalidraw.git
synced 2025-05-03 10:00:07 -04:00
fix: React.memo resolvers not accounting for all props (#6042)
This commit is contained in:
parent
06b45e0cfc
commit
618442299f
3 changed files with 54 additions and 27 deletions
12
src/utils.ts
12
src/utils.ts
|
@ -709,3 +709,15 @@ export const ReactChildrenToObject = <
|
|||
return acc;
|
||||
}, {} as Partial<T>);
|
||||
};
|
||||
|
||||
export const isShallowEqual = <T extends Record<string, any>>(
|
||||
objA: T,
|
||||
objB: T,
|
||||
) => {
|
||||
const aKeys = Object.keys(objA);
|
||||
const bKeys = Object.keys(objA);
|
||||
if (aKeys.length !== bKeys.length) {
|
||||
return false;
|
||||
}
|
||||
return aKeys.every((key) => objA[key] === objB[key]);
|
||||
};
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue