fix: remove tln after unmount

This commit is contained in:
Peng Xiao
2022-08-24 17:34:55 +08:00
parent 37d0ad2524
commit 0d8477534f

View File

@@ -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<any> }
declare const window: Window & { tln?: TLReactApp<any> }
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])