Skip to content
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

lastPlayedEvent not populated w FullSnapshot on 'fullsnapshot-rebuilded' event #244

Closed
eoghanmurray opened this issue Jul 14, 2020 · 2 comments

Comments

@eoghanmurray
Copy link
Contributor

	rrweb_replayer.on('fullsnapshot-rebuilded', function() {
            if (rrweb_replayer.lastPlayedEvent.type == rrweb.EventType.FullSnapshot) {
                 console.log('expected');
            } else if (rrweb_replayer.lastPlayedEvent.type == rrweb.EventType.Meta) {
                 console.error('unexpected');
            }
        }

The output is unexpected.

I've actually already written code which relys on the Meta event (in order to know the current URL and update the UI), but I've now run into a case where I need to look at the DOM produced.

Should we:

  • have separate events for the Meta & FullSnapshot ('new-page-load', 'new-page-rendered')?
  • pass in the event itself to the callback function?
@Yuyz0112
Copy link
Member

I've passed the event to the callback function.

There is also a general event-cast event, which will emit when event cast and has the event as its payload. Looks like a solution to handle meta event without providing more event types.

@eoghanmurray
Copy link
Contributor Author

Cool, should we deprecate the fullsnapshot-rebuilded event?

The correct English is 'rebuilt' so maybe we could create a new event for the FullSnapshot called fullsnapshot-rebuilt (which gets called correctly after the rebuilding is done).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants