diff --git a/src/lib/teact/teact.ts b/src/lib/teact/teact.ts index 8c2b71cc1..4f5c4c189 100644 --- a/src/lib/teact/teact.ts +++ b/src/lib/teact/teact.ts @@ -447,10 +447,6 @@ export function useState(initial?: T): [T, StateHookSetter] { value: initial, nextValue: initial, setter: ((componentInstance) => (newValue: ((current: T) => T) | T) => { - if (!componentInstance.isMounted) { - return; - } - if (byCursor[cursor].nextValue !== newValue) { byCursor[cursor].nextValue = typeof newValue === 'function' ? (newValue as (current: T) => T)(byCursor[cursor].value) @@ -466,8 +462,8 @@ export function useState(initial?: T): [T, StateHookSetter] { console.log( '[Teact.useState]', componentInstance.name, - // eslint-disable-next-line max-len - (componentInstance.Component as FC_withDebug).DEBUG_contentComponentName + // `componentInstance.Component` may be set to `null` by GC helper + componentInstance.Component && (componentInstance.Component as FC_withDebug).DEBUG_contentComponentName ? `> ${(componentInstance.Component as FC_withDebug).DEBUG_contentComponentName}` : '', `Forced update at cursor #${cursor}, next value: `,