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

Fix an incorrected finish which halted playback prematurely #606

Merged
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 6 additions & 3 deletions src/replay/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -493,13 +493,16 @@ export class Replayer {
this.service.send({ type: 'CAST_EVENT', payload: { event } });

// events are kept sorted by timestamp, check if this is the last event
let last_index = this.service.state.context.events.length - 1;
if (
event ===
this.service.state.context.events[
this.service.state.context.events.length - 1
]
this.service.state.context.events[last_index]
) {
const finish = () => {
if (last_index < this.service.state.context.events.length - 1) {
// more events have been added since the setTimeout
return;
}
this.backToNormal();
this.service.send('END');
this.emitter.emit(ReplayerEvents.Finish);
Expand Down