File tree Expand file tree Collapse file tree 6 files changed +11
-31
lines changed Expand file tree Collapse file tree 6 files changed +11
-31
lines changed Original file line number Diff line number Diff line change @@ -87,10 +87,6 @@ export class EffectScope implements ReactiveNode {
87
87
if ( sub !== undefined ) {
88
88
unlink ( sub )
89
89
}
90
- this . cleanup ( )
91
- }
92
-
93
- cleanup ( ) : void {
94
90
cleanup ( this )
95
91
}
96
92
}
Original file line number Diff line number Diff line change @@ -195,7 +195,7 @@ describe('renderer: VaporTeleport', () => {
195
195
expect ( target . innerHTML ) . toBe ( '<div>teleported 2</div>' )
196
196
} )
197
197
198
- test ( 'parent rerender + toggle disabled' , async ( ) => {
198
+ test . todo ( 'parent rerender + toggle disabled' , async ( ) => {
199
199
const target = document . createElement ( 'div' )
200
200
const root = document . createElement ( 'div' )
201
201
const parentId = 'test3-parent-rerender'
Original file line number Diff line number Diff line change @@ -20,6 +20,7 @@ import {
20
20
isFragment ,
21
21
} from './fragment'
22
22
import { child } from './dom/node'
23
+ import { TeleportFragment } from './components/Teleport'
23
24
24
25
export interface TransitionOptions {
25
26
$key ?: any
@@ -182,12 +183,12 @@ export function normalizeBlock(block: Block): Node[] {
182
183
} else if ( isVaporComponent ( block ) ) {
183
184
nodes . push ( ...normalizeBlock ( block . block ! ) )
184
185
} else {
185
- if ( block . getNodes ) {
186
- nodes . push ( ... normalizeBlock ( block . getNodes ( ) ) )
186
+ if ( block instanceof TeleportFragment ) {
187
+ nodes . push ( block . placeholder ! , block . anchor ! )
187
188
} else {
188
189
nodes . push ( ...normalizeBlock ( block . nodes ) )
190
+ block . anchor && nodes . push ( block . anchor )
189
191
}
190
- block . anchor && nodes . push ( block . anchor )
191
192
}
192
193
return nodes
193
194
}
Original file line number Diff line number Diff line change 3
3
type TeleportTargetElement ,
4
4
isTeleportDeferred ,
5
5
isTeleportDisabled ,
6
- onScopeDispose ,
7
6
queuePostFlushCb ,
8
7
resolveTeleportTarget ,
9
8
warn ,
@@ -61,14 +60,6 @@ export class TeleportFragment extends VaporFragment {
61
60
? createComment ( 'teleport end' )
62
61
: createTextNode ( )
63
62
64
- this . init ( )
65
- }
66
-
67
- get parent ( ) : ParentNode | null {
68
- return this . anchor ? this . anchor . parentNode : null
69
- }
70
-
71
- private init ( ) : void {
72
63
renderEffect ( ( ) => {
73
64
// access the props to trigger tracking
74
65
this . resolvedProps = extend (
@@ -84,23 +75,18 @@ export class TeleportFragment extends VaporFragment {
84
75
if ( ! isHydrating ) {
85
76
this . initChildren ( )
86
77
}
78
+ }
87
79
88
- if ( __DEV__ ) {
89
- onScopeDispose ( this . remove )
90
- // used in `normalizeBlock` to get nodes of TeleportFragment during
91
- // HMR updates. returns empty array if content is mounted in target
92
- // container to prevent incorrect parent node lookup.
93
- this . getNodes = ( ) =>
94
- this . parent !== this . mountContainer ! ? [ ] : this . nodes
95
- }
80
+ get parent ( ) : ParentNode | null {
81
+ return this . anchor ? this . anchor . parentNode : null
96
82
}
97
83
98
84
private initChildren ( ) : void {
99
- renderEffect ( ( ) =>
85
+ renderEffect ( ( ) => {
100
86
this . handleChildrenUpdate (
101
87
this . rawSlots ! . default && ( this . rawSlots ! . default as BlockFn ) ( ) ,
102
- ) ,
103
- )
88
+ )
89
+ } )
104
90
105
91
if ( __DEV__ ) {
106
92
const nodes = this . nodes
Original file line number Diff line number Diff line change @@ -41,7 +41,6 @@ export class VaporFragment<T extends Block = Block>
41
41
remove ?: ( parent ?: ParentNode , transitionHooks ?: TransitionHooks ) => void
42
42
fallback ?: BlockFn
43
43
44
- getNodes ?: ( ) => Block
45
44
setRef ?: ( comp : VaporComponentInstance ) => void
46
45
47
46
constructor ( nodes : T ) {
Original file line number Diff line number Diff line change @@ -19,7 +19,6 @@ export function hmrRerender(instance: VaporComponentInstance): void {
19
19
const parent = normalized [ 0 ] . parentNode !
20
20
const anchor = normalized [ normalized . length - 1 ] . nextSibling
21
21
remove ( instance . block , parent )
22
- instance . scope ! . cleanup ( )
23
22
const prev = setCurrentInstance ( instance )
24
23
pushWarningContext ( instance )
25
24
devRender ( instance )
@@ -46,7 +45,6 @@ export function hmrReload(
46
45
)
47
46
setCurrentInstance ( ...prev )
48
47
mountComponent ( newInstance , parent , anchor )
49
-
50
48
updateParentBlockOnHmrReload ( parentInstance , instance , newInstance )
51
49
updateParentTeleportOnHmrReload ( instance , newInstance )
52
50
}
You can’t perform that action at this time.
0 commit comments