From 14ed8ad1e6b24ab1c4cda85d01394b04c737af1c Mon Sep 17 00:00:00 2001 From: Lucky Feng Date: Wed, 1 Apr 2026 12:00:00 +0800 Subject: [PATCH] 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 --- src/replay/index.ts | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/src/replay/index.ts b/src/replay/index.ts index 7bfc9877..09a45944 100644 --- a/src/replay/index.ts +++ b/src/replay/index.ts @@ -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);