|
|
@@ -4,6 +4,7 @@ import { DynamicFragment } from './fragment'
|
|
|
import {
|
|
|
insertionAnchor,
|
|
|
insertionParent,
|
|
|
+ isLastInsertion,
|
|
|
resetInsertionState,
|
|
|
} from './insertionState'
|
|
|
import { renderEffect } from './renderEffect'
|
|
|
@@ -11,6 +12,7 @@ import { renderEffect } from './renderEffect'
|
|
|
export function createKeyedFragment(key: () => any, render: BlockFn): Block {
|
|
|
const _insertionParent = insertionParent
|
|
|
const _insertionAnchor = insertionAnchor
|
|
|
+ const _isLastInsertion = isLastInsertion
|
|
|
if (!isHydrating) resetInsertionState()
|
|
|
|
|
|
const frag = __DEV__ ? new DynamicFragment('keyed') : new DynamicFragment()
|
|
|
@@ -21,7 +23,7 @@ export function createKeyedFragment(key: () => any, render: BlockFn): Block {
|
|
|
if (!isHydrating) {
|
|
|
if (_insertionParent) insert(frag, _insertionParent, _insertionAnchor)
|
|
|
} else {
|
|
|
- if (_insertionAnchor !== undefined) {
|
|
|
+ if (_isLastInsertion) {
|
|
|
advanceHydrationNode(_insertionParent!)
|
|
|
}
|
|
|
}
|