refactor(Suspense): remove unnecessary casts (#819)
This commit is contained in:
parent
16a737dc67
commit
f59779706b
@ -260,7 +260,7 @@ function hasPropsChanged(prevProps: Data, nextProps: Data): boolean {
|
|||||||
|
|
||||||
export function updateHOCHostEl(
|
export function updateHOCHostEl(
|
||||||
{ vnode, parent }: ComponentInternalInstance,
|
{ vnode, parent }: ComponentInternalInstance,
|
||||||
el: object // HostNode
|
el: typeof vnode.el // HostNode
|
||||||
) {
|
) {
|
||||||
while (parent && parent.subTree === vnode) {
|
while (parent && parent.subTree === vnode) {
|
||||||
;(vnode = parent.vnode).el = el
|
;(vnode = parent.vnode).el = el
|
||||||
|
@ -255,8 +255,8 @@ function createSuspenseBoundary<HostNode, HostElement>(
|
|||||||
hiddenContainer,
|
hiddenContainer,
|
||||||
anchor,
|
anchor,
|
||||||
deps: 0,
|
deps: 0,
|
||||||
subTree: null as any, // will be set immediately after creation
|
subTree: (null as unknown) as VNode, // will be set immediately after creation
|
||||||
fallbackTree: null as any, // will be set immediately after creation
|
fallbackTree: (null as unknown) as VNode, // will be set immediately after creation
|
||||||
isResolved: false,
|
isResolved: false,
|
||||||
isUnmounted: false,
|
isUnmounted: false,
|
||||||
effects: [],
|
effects: [],
|
||||||
@ -290,11 +290,11 @@ function createSuspenseBoundary<HostNode, HostElement>(
|
|||||||
// if the fallback tree was mounted, it may have been moved
|
// if the fallback tree was mounted, it may have been moved
|
||||||
// as part of a parent suspense. get the latest anchor for insertion
|
// as part of a parent suspense. get the latest anchor for insertion
|
||||||
anchor = next(fallbackTree)
|
anchor = next(fallbackTree)
|
||||||
unmount(fallbackTree as VNode, parentComponent, suspense, true)
|
unmount(fallbackTree, parentComponent, suspense, true)
|
||||||
}
|
}
|
||||||
// move content from off-dom container to actual container
|
// move content from off-dom container to actual container
|
||||||
move(subTree as VNode, container, anchor, MoveType.ENTER)
|
move(subTree, container, anchor, MoveType.ENTER)
|
||||||
const el = (vnode.el = (subTree as VNode).el!)
|
const el = (vnode.el = subTree.el!)
|
||||||
// suspense as the root node of a component...
|
// suspense as the root node of a component...
|
||||||
if (parentComponent && parentComponent.subTree === vnode) {
|
if (parentComponent && parentComponent.subTree === vnode) {
|
||||||
parentComponent.vnode.el = el
|
parentComponent.vnode.el = el
|
||||||
@ -340,7 +340,7 @@ function createSuspenseBoundary<HostNode, HostElement>(
|
|||||||
|
|
||||||
// move content tree back to the off-dom container
|
// move content tree back to the off-dom container
|
||||||
const anchor = next(subTree)
|
const anchor = next(subTree)
|
||||||
move(subTree as VNode, hiddenContainer, null, MoveType.LEAVE)
|
move(subTree, hiddenContainer, null, MoveType.LEAVE)
|
||||||
// remount the fallback tree
|
// remount the fallback tree
|
||||||
patch(
|
patch(
|
||||||
null,
|
null,
|
||||||
@ -352,7 +352,7 @@ function createSuspenseBoundary<HostNode, HostElement>(
|
|||||||
isSVG,
|
isSVG,
|
||||||
optimized
|
optimized
|
||||||
)
|
)
|
||||||
const el = (vnode.el = (fallbackTree as VNode).el!)
|
const el = (vnode.el = fallbackTree.el!)
|
||||||
// suspense as the root node of a component...
|
// suspense as the root node of a component...
|
||||||
if (parentComponent && parentComponent.subTree === vnode) {
|
if (parentComponent && parentComponent.subTree === vnode) {
|
||||||
parentComponent.vnode.el = el
|
parentComponent.vnode.el = el
|
||||||
|
Loading…
Reference in New Issue
Block a user