-
-
Notifications
You must be signed in to change notification settings - Fork 1.4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
fix: reset fns when when stopping record #962
Conversation
(wrappedEmit as unknown) = undefined; | ||
(takeFullSnapshot as unknown) = undefined; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This doesn't reset the fns to their original state, this removes the functions
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This doesn't reset the fns to their original state, this removes the functions
These two fns(wrappedEmit
and takeFullSnapshot
) are undefined
when record
is not invoked
In record.addCustomEvent
and record.takeFullSnapshot
:
Determine whether it is recording by judging whether wrappedEmit
or takeFullSnapshot
is falsy
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In the below case:
import { record } from "rrweb"
// start record
const stopRecord = record({
emit: xxx,
})
// stopRecord
stopRecord()
// still invoke
record.addCustomEvent()
record.takeFullSnapshot()
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good catch @wfk007, thanks for finding this and clarifying!
(wrappedEmit as unknown) = undefined; | ||
(takeFullSnapshot as unknown) = undefined; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good catch @wfk007, thanks for finding this and clarifying!
Thanks! |
Hi @wfk007 ! After this change, we've noticed that when calling the stop recording callback, observers are not immediately stopped throw the following error: rrweb/packages/rrweb/src/record/index.ts Lines 561 to 566 in 2286c11
Could the rrweb/packages/rrweb/src/record/observer.ts Line 157 in 2286c11
|
## Summary update to include HIG-2959 fix as well as updating rrweb fork. see highlight/rrweb#94 and highlight/rrweb#93 See #3200 Fixed by reverting rrweb-io/rrweb#962 which causes problems. Will be pointing out the observers issue there. This also cleans up some client state logic which should make sure we do not call `rrweb.addCustomEvent` which we are not recording ## How did you test this change? Before: ![image](https://user-images.githubusercontent.com/1351531/196545769-12c0ff1f-44a6-40a5-8457-9f224785a7e3.png) After: ![image](https://user-images.githubusercontent.com/1351531/196560173-8b550e2e-1b4d-48c8-a00e-04f69f62197f.png) ## Are there any deployment considerations? Bumped client version.
@Vadman97 thx for your reply. I encounterred this error too. |
@wfk007 I encountered this error as well. Do you have any idea or plan to fix this? |
I have come up with three ways to fix this uncaught error
@Yuyz0112 @Juice10 @Mark-Fenng Hi all, any ideas for this uncaught error |
reset
wrappedEmit
andtakeFullSnapshot
when stopping recordrrweb/packages/rrweb/src/record/index.ts
Line 528 in 5f59f91
rrweb/packages/rrweb/src/record/index.ts
Line 547 in 5f59f91