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({