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

This commit is contained in:
Steve Ruiz 2021-11-18 16:38:49 +00:00
parent 2f1816404b
commit 2f8d973b07

View file

@ -1879,7 +1879,8 @@ export class TldrawApp extends StateManager<TDSnapshot> {
startSession = <T extends SessionType>(type: T, ...args: SessionArgsOfType<T>): this => {
if (this.readOnly && type !== SessionType.Brush) return this
if (this.session) {
throw Error(`Already in a session! (${this.session.constructor.name})`)
console.warn(`Already in a session! (${this.session.constructor.name})`)
this.cancelSession()
}
const Session = getSession(type)