put `getCurrentPageId` into a computed (#3378)

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
pull/3377/head^2
Steve Ruiz 2024-04-05 17:02:11 +01:00 zatwierdzone przez GitHub
rodzic f1e0af7631
commit 4d32a38cf8
Nie znaleziono w bazie danych klucza dla tego podpisu
ID klucza GPG: B5690EEEBB952194
1 zmienionych plików z 1 dodań i 1 usunięć

Wyświetl plik

@ -3325,7 +3325,7 @@ export class Editor extends EventEmitter<TLEventMap> {
*
* @public
*/
getCurrentPageId(): TLPageId {
@computed getCurrentPageId(): TLPageId {
return this.getInstanceState().currentPageId
}