Skip to content

Commit

Permalink
👌 Removing unnecessary map from stale field check method
Browse files Browse the repository at this point in the history
  • Loading branch information
MiloradFilipovic committed Dec 20, 2024
1 parent 25412ca commit 675f4fa
Showing 1 changed file with 3 additions and 4 deletions.
7 changes: 3 additions & 4 deletions packages/editor-ui/src/utils/nodeTypesUtils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -448,13 +448,12 @@ export const isResourceMapperFieldListStale = (
return true;
}

// Create maps for O(1) lookup
const oldFieldsMap = new Map(oldFields.map((field) => [field.id, field]));
// Create map for O(1) lookup
const newFieldsMap = new Map(newFields.map((field) => [field.id, field]));

// Check if any fields were removed or modified
for (const [id, oldField] of oldFieldsMap) {
const newField = newFieldsMap.get(id);
for (const oldField of oldFields) {
const newField = newFieldsMap.get(oldField.id);

// Field was removed
if (!newField) {
Expand Down

0 comments on commit 675f4fa

Please sign in to comment.