Bladeren bron

Fix error when starting a session while already in a session.

main
Steve Ruiz 3 jaren geleden
bovenliggende
commit
2f8d973b07
1 gewijzigde bestanden met toevoegingen van 2 en 1 verwijderingen
  1. 2
    1
      packages/tldraw/src/state/TldrawApp.ts

+ 2
- 1
packages/tldraw/src/state/TldrawApp.ts Bestand weergeven

1879
   startSession = <T extends SessionType>(type: T, ...args: SessionArgsOfType<T>): this => {
1879
   startSession = <T extends SessionType>(type: T, ...args: SessionArgsOfType<T>): this => {
1880
     if (this.readOnly && type !== SessionType.Brush) return this
1880
     if (this.readOnly && type !== SessionType.Brush) return this
1881
     if (this.session) {
1881
     if (this.session) {
1882
-      throw Error(`Already in a session! (${this.session.constructor.name})`)
1882
+      console.warn(`Already in a session! (${this.session.constructor.name})`)
1883
+      this.cancelSession()
1883
     }
1884
     }
1884
 
1885
 
1885
     const Session = getSession(type)
1886
     const Session = getSession(type)

Laden…
Annuleren
Opslaan