Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
27 changes: 12 additions & 15 deletions Sources/ElementaryUI/Reconciling/ApplicationRuntime.swift
Original file line number Diff line number Diff line change
Expand Up @@ -18,22 +18,19 @@ final class ApplicationRuntime<DOMInteractor: DOM.Interactor> {
$0.disablesAnimation = true
} run: { tx in

tx.scheduler.addCommitAction { [self, transaction = tx.transaction, rootView] ctx in
self.rootNode =
ctx.withMountContext(transaction: transaction) {
(mountCtx: consuming _MountContext) in
let node = _ConditionalNode(
isA: true,
context: _ViewContext(),
ctx: &mountCtx,
makeActive: { viewContext, mountCtx in
RootView._makeNode(rootView, context: viewContext, ctx: &mountCtx)
}
)

_ = mountCtx.mountInDOMNode(domRoot, observers: [])
return node
self.rootNode = scheduler.withMountContext(tx: &tx) {
(mountCtx: consuming _MountContext) in
let node = _ConditionalNode(
isA: true,
context: _ViewContext(),
ctx: &mountCtx,
makeActive: { viewContext, mountCtx in
RootView._makeNode(rootView, context: viewContext, ctx: &mountCtx)
}
)

_ = mountCtx.mountInDOMNode(domRoot, isRoot: true)
return node
}
}
}
Expand Down
19 changes: 8 additions & 11 deletions Sources/ElementaryUI/Reconciling/KeyedDiffEngine.swift
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ struct KeyedDiffEngine: ~Copyable {
leavingSlots: inout UniqueArray<MountContainer.Slot>,
removedSlots: inout UniqueArray<MountContainer.Slot>,
keys: borrowing Span<_ViewKey>,
transaction: Transaction
makeNewSlot: (Int, _ViewKey) -> MountContainer.Slot
) -> Bool {
let oldCount = activeSlots.count
let newCount = keys.count
Expand Down Expand Up @@ -72,25 +72,22 @@ struct KeyedDiffEngine: ~Copyable {
outputSpan.append(self.takeActiveCell(at: source))
} else if source == KeyedDiffSource.new {
outputSpan.append(
.pending(
key: newMiddleKeys[unchecked: middleOffset],
transaction: transaction,
newKeyIndex: prefixCount + middleOffset
makeNewSlot(
prefixCount + middleOffset,
newMiddleKeys[unchecked: middleOffset]
)
)
} else {
let leavingIndex = KeyedDiffSource.decodeRevive(source)
if leavingIndex >= 0 && leavingIndex < self.leavingCells.count,
var revived = self.leavingCells[leavingIndex].take()
let revived = self.leavingCells[leavingIndex].take()
{
revived.markReviving()
outputSpan.append(revived)
} else {
outputSpan.append(
.pending(
key: newMiddleKeys[unchecked: middleOffset],
transaction: transaction,
newKeyIndex: prefixCount + middleOffset
makeNewSlot(
prefixCount + middleOffset,
newMiddleKeys[unchecked: middleOffset]
)
)
}
Expand Down
2 changes: 1 addition & 1 deletion Sources/ElementaryUI/Reconciling/LayoutContainer.swift
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ final class LayoutContainer {
self.layoutObservers = layoutObservers
}

func mountInitial(_ context: inout _CommitContext) {
func commitInitialLayout(_ context: inout _CommitContext) {
context.scheduler.scratch.withLayoutEntryScratchFrame { scratch in
var ops = LayoutPass(layoutContainer: self, scratch: consume scratch)
layoutNodes.collect(into: &ops, context: &context, op: .added)
Expand Down
Loading
Loading