From 8092c0f3e59146e893d7f0204cbaf29e5dfcd96b Mon Sep 17 00:00:00 2001 From: Dustin Brett Date: Mon, 17 Feb 2025 21:58:26 -0800 Subject: [PATCH] Ensure changes dont overlap past states --- utils/functions.ts | 23 +++++++++++++++-------- 1 file changed, 15 insertions(+), 8 deletions(-) diff --git a/utils/functions.ts b/utils/functions.ts index 7ba3fe49..51ab7006 100644 --- a/utils/functions.ts +++ b/utils/functions.ts @@ -680,14 +680,21 @@ export const updateIconPositions = ( ); const newIconPositions = Object.fromEntries( Object.entries(adjustIconPositions).filter( - ([, { gridColumnStart, gridRowStart }]) => - !Object.values(updatedIconPositions).some( - ({ - gridColumnStart: currentGridColumnStart, - gridRowStart: currentRowColumnStart, - }) => - gridColumnStart === currentGridColumnStart && - gridRowStart === currentRowColumnStart + ([entryFile, { gridColumnStart, gridRowStart }]) => + !Object.entries({ + ...updatedIconPositions, + ...adjustIconPositions, + }).some( + ([ + compareEntryFile, + { + gridColumnStart: compareGridColumnStart, + gridRowStart: compareGridRowStart, + }, + ]) => + entryFile !== compareEntryFile && + gridColumnStart === compareGridColumnStart && + gridRowStart === compareGridRowStart ) ) );