Skip to content

Commit

Permalink
Optimize data reset
Browse files Browse the repository at this point in the history
  • Loading branch information
RoyEJohnson committed Aug 20, 2024
1 parent b5a9ebb commit 801d19e
Showing 1 changed file with 2 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,8 @@ export default function useLayoutParameters() {
// eslint-disable-next-line no-shadow
({name, data}: { name: string; data: unknown;}) => {
setLayoutName(name);
if (JSON.stringify(data) !== JSON.stringify(layoutData)) {
// Optimization: it doesn't matter whether data gets reset if it is undefined
if (JSON.stringify(data) !== JSON.stringify(layoutData) && data !== undefined) {
setLayoutData(data);
}
},
Expand Down

0 comments on commit 801d19e

Please sign in to comment.