Teact: Fix unexpected ref reset
This commit is contained in:
parent
5652dd1fc4
commit
819280b191
@ -299,10 +299,10 @@ export function unmountRealTree($element: VirtualElement) {
|
|||||||
if (isTagElement($element)) {
|
if (isTagElement($element)) {
|
||||||
if ($element.target) {
|
if ($element.target) {
|
||||||
removeAllDelegatedListeners($element.target as HTMLElement);
|
removeAllDelegatedListeners($element.target as HTMLElement);
|
||||||
}
|
|
||||||
|
|
||||||
if ($element.props.ref) {
|
if ($element.props.ref?.current === $element.target) {
|
||||||
$element.props.ref.current = undefined; // Help GC
|
$element.props.ref.current = undefined;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user