From 7c0476575238e2732ea8954dfbbaa8499117533d Mon Sep 17 00:00:00 2001 From: Yanzhen Yu Date: Fri, 23 Oct 2020 13:40:13 +0800 Subject: [PATCH] ignore removed move set --- src/record/mutation.ts | 6 ++++++ test/record.test.ts | 2 +- 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/src/record/mutation.ts b/src/record/mutation.ts index ec68f89b..1c488f7f 100644 --- a/src/record/mutation.ts +++ b/src/record/mutation.ts @@ -227,6 +227,12 @@ export default class MutationBuffer { } for (const n of this.movedSet) { + if ( + isParentRemoved(this.removes, n) && + !this.movedSet.has(n.parentNode!) + ) { + continue; + } pushAdd(n); } diff --git a/test/record.test.ts b/test/record.test.ts index 417c3a27..33692c86 100644 --- a/test/record.test.ts +++ b/test/record.test.ts @@ -157,7 +157,7 @@ describe('record', function (this: ISuite) { expect(this.events[35].type).to.equal(EventType.FullSnapshot); }); - it('is safe to checkout during async callbacks', async () => { + it.only('is safe to checkout during async callbacks', async () => { await this.page.evaluate(() => { const { record } = ((window as unknown) as IWindow).rrweb; record({