From fe75f29c15d8bcbb787ab6fdd8ce810167bf7f94 Mon Sep 17 00:00:00 2001 From: David Luzar <5153846+dwelle@users.noreply.github.com> Date: Sat, 25 Nov 2023 23:32:05 +0100 Subject: [PATCH] fix: disable caching bounds for arrow labels (#7343) --- src/element/bounds.ts | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/src/element/bounds.ts b/src/element/bounds.ts index eddd4083..b0d33cfc 100644 --- a/src/element/bounds.ts +++ b/src/element/bounds.ts @@ -13,6 +13,7 @@ import { Point } from "../types"; import { generateRoughOptions } from "../scene/Shape"; import { isArrowElement, + isBoundToContainer, isFreeDrawElement, isLinearElement, isTextElement, @@ -54,7 +55,13 @@ export class ElementBounds { static getBounds(element: ExcalidrawElement) { const cachedBounds = ElementBounds.boundsCache.get(element); - if (cachedBounds?.version && cachedBounds.version === element.version) { + if ( + cachedBounds?.version && + cachedBounds.version === element.version && + // we don't invalidate cache when we update containers and not labels, + // which is causing problems down the line. Fix TBA. + !isBoundToContainer(element) + ) { return cachedBounds.bounds; }