From 4d32a38cf8ff34304c01b660e491b220e3b1bd9a Mon Sep 17 00:00:00 2001 From: Steve Ruiz Date: Fri, 5 Apr 2024 17:02:11 +0100 Subject: [PATCH] put `getCurrentPageId` into a computed (#3378) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This PR makes the `getCurrentPageId` method use a computed. Previously, anything that referenced the current page id would pick up any change to instance state. This will help a bunch of interactions like brushing that would update the instance state on every frame. ### Change Type - [x] `sdk` — Changes the tldraw SDK - [x] `improvement` — Improving existing features --- packages/editor/src/lib/editor/Editor.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/editor/src/lib/editor/Editor.ts b/packages/editor/src/lib/editor/Editor.ts index 96fa1729e..7c635e66f 100644 --- a/packages/editor/src/lib/editor/Editor.ts +++ b/packages/editor/src/lib/editor/Editor.ts @@ -3325,7 +3325,7 @@ export class Editor extends EventEmitter { * * @public */ - getCurrentPageId(): TLPageId { + @computed getCurrentPageId(): TLPageId { return this.getInstanceState().currentPageId }