From 5fdee602f12fcd068fdb42e113db7e6afc6e624f Mon Sep 17 00:00:00 2001 From: Eric NGUYEN Date: Wed, 31 Aug 2022 10:55:34 +0200 Subject: [PATCH] Fix ApplyBehaviorsOnSiblings type and performance --- src/Components/Editor/Behaviors/Behaviors.ts | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/src/Components/Editor/Behaviors/Behaviors.ts b/src/Components/Editor/Behaviors/Behaviors.ts index feae69e..f00bba7 100644 --- a/src/Components/Editor/Behaviors/Behaviors.ts +++ b/src/Components/Editor/Behaviors/Behaviors.ts @@ -42,12 +42,17 @@ export function ApplyBehaviors(container: IContainerModel, symbols: Map): void { +export function ApplyBehaviorsOnSiblings(newContainer: IContainerModel, symbols: Map): void { if (newContainer.parent === null || newContainer.parent === undefined) { return; } newContainer.parent.children - .filter(container => newContainer !== container) - .forEach(container => ApplyBehaviors(container, symbols)); + .forEach((container: IContainerModel) => { + if (container === newContainer) { + return; + } + + ApplyBehaviors(container, symbols); + }); }