fix: applyScroll function doesn't work in sync mode(play at a specific time) (#426)

applyScroll function should be called after all of new nodes mounted on dom
This commit is contained in:
Lucky Feng
2026-04-01 12:00:00 +08:00
committed by GitHub
parent 8833d3c7ce
commit 14ed8ad1e6

View File

@@ -115,13 +115,6 @@ export class Replayer {
this.emitter.on(ReplayerEvents.Flush, () => {
const { scrollMap, inputMap } = this.treeIndex.flush();
for (const d of scrollMap.values()) {
this.applyScroll(d);
}
for (const d of inputMap.values()) {
this.applyInput(d);
}
for (const [frag, parent] of this.fragmentParentMap.entries()) {
mirror.map[parent.__sn.id] = parent;
/**
@@ -138,6 +131,13 @@ export class Replayer {
parent.appendChild(frag);
}
this.fragmentParentMap.clear();
for (const d of scrollMap.values()) {
this.applyScroll(d);
}
for (const d of inputMap.values()) {
this.applyInput(d);
}
});
const timer = new Timer([], config?.speed || defaultConfig.speed);