Fix error when starting a session while already in a session.
This commit is contained in:
parent
2f1816404b
commit
2f8d973b07
1 changed files with 2 additions and 1 deletions
|
@ -1879,7 +1879,8 @@ export class TldrawApp extends StateManager<TDSnapshot> {
|
||||||
startSession = <T extends SessionType>(type: T, ...args: SessionArgsOfType<T>): this => {
|
startSession = <T extends SessionType>(type: T, ...args: SessionArgsOfType<T>): this => {
|
||||||
if (this.readOnly && type !== SessionType.Brush) return this
|
if (this.readOnly && type !== SessionType.Brush) return this
|
||||||
if (this.session) {
|
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)
|
const Session = getSession(type)
|
||||||
|
|
Loading…
Reference in a new issue