File tree Expand file tree Collapse file tree
packages/core/src/runtime Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -7,10 +7,10 @@ options.unmount = vnode => {
77 if ( typeof type === 'function' && vnodesForComponent . has ( type ) ) {
88 const vnodes = vnodesForComponent . get ( type ) ;
99 if ( vnodes ) {
10- const mountedVnodesForType = vnodes . filter (
11- p => p . __c && p . __c !== vnode . __c
12- ) ;
13- vnodesForComponent . set ( vnode . type , mountedVnodesForType ) ;
10+ const index = vnodes . indexOf ( vnode ) ;
11+ if ( index !== - 1 ) {
12+ vnodes . splice ( index , 1 ) ;
13+ }
1414 }
1515 }
1616
Original file line number Diff line number Diff line change 11import { options } from 'preact' ;
2- import { vnodesForComponent , mappedVNodes , lastSeen } from './vnodesForComponent' ;
2+ import {
3+ vnodesForComponent ,
4+ mappedVNodes ,
5+ lastSeen ,
6+ } from './vnodesForComponent' ;
37import { VNODE_COMPONENT } from '../constants' ;
48
59const getMappedVnode = type => {
@@ -13,11 +17,11 @@ const getMappedVnode = type => {
1317const BUILT_IN_COMPONENTS = [ 'Fragment' , 'Suspense' , 'SuspenseList' ] ;
1418
1519const isBuiltIn = type => {
16- return BUILT_IN_COMPONENTS . includes ( type . name )
17- }
20+ return BUILT_IN_COMPONENTS . includes ( type . name ) ;
21+ } ;
1822
19- const oldVnode = options . vnode ;
20- options . vnode = vnode => {
23+ const oldVnode = options . __b ;
24+ options . __b = vnode => {
2125 if ( vnode && typeof vnode . type === 'function' && ! isBuiltIn ( vnode . type ) ) {
2226 const vnodes = vnodesForComponent . get ( vnode . type ) ;
2327 if ( ! vnodes ) {
You can’t perform that action at this time.
0 commit comments