From 0d8477534f86f03cf4b05fa3cac3f01b2ff62fb4 Mon Sep 17 00:00:00 2001 From: Peng Xiao Date: Wed, 24 Aug 2022 17:34:55 +0800 Subject: [PATCH] fix: remove tln after unmount --- tldraw/packages/react/src/hooks/useSetup.ts | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/tldraw/packages/react/src/hooks/useSetup.ts b/tldraw/packages/react/src/hooks/useSetup.ts index da43f89adf..01887418d8 100644 --- a/tldraw/packages/react/src/hooks/useSetup.ts +++ b/tldraw/packages/react/src/hooks/useSetup.ts @@ -2,7 +2,7 @@ import * as React from 'react' import type { TLAppPropsWithoutApp, TLAppPropsWithApp } from '~components' import type { TLReactShape, TLReactApp } from '~lib' -declare const window: Window & { tln: TLReactApp } +declare const window: Window & { tln?: TLReactApp } export function useSetup< S extends TLReactShape = TLReactShape, @@ -31,6 +31,7 @@ export function useSetup< if (onMount) onMount(app, null) return () => { unsubs.forEach(unsub => unsub()) + window['tln'] = undefined } }, [app])