From 84827eea968433ba6df548491b8118fdd348fb8a Mon Sep 17 00:00:00 2001 From: Steve Ruiz Date: Wed, 23 Jun 2021 16:51:22 +0100 Subject: [PATCH] fix early break in sessions --- components/canvas/shape.tsx | 2 +- state/session.ts | 8 ++------ 2 files changed, 3 insertions(+), 7 deletions(-) diff --git a/components/canvas/shape.tsx b/components/canvas/shape.tsx index 08fbbd62b..7a7dfa437 100644 --- a/components/canvas/shape.tsx +++ b/components/canvas/shape.tsx @@ -68,7 +68,7 @@ function Shape({ id, isSelecting, parentPoint }: ShapeProps): JSX.Element { device={isMobileDevice ? 'mobile' : 'desktop'} {...events} > - {!isShy && ( + {isSelecting && !isShy && ( <> {isForeignObject ? ( (...args: Parameters) { - const session = this.#current - - if (session === undefined) return this - - session.complete.call(this.#current, ...args) + this.#current?.complete.call(this.#current, ...args) this.#current = undefined return this } @@ -89,7 +85,7 @@ class SessionManager { * ``` */ cancel(...args: Parameters) { - this.#current.cancel.call(this.#current, ...args) + this.#current?.cancel.call(this.#current, ...args) this.#current = undefined return this }