Skip to content

Commit cd61ba9

Browse files
authored
Merge pull request webdevcody#701 from jwtly10/700-replay-mode-not-playing
Fixed passing falsy value when timestamp diff is 0
2 parents 1f8ec08 + ff12f82 commit cd61ba9

File tree

1 file changed

+9
-5
lines changed

1 file changed

+9
-5
lines changed

packages/app/src/app/result/replay-timestamps.tsx

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -33,14 +33,18 @@ export const ReplayCode = ({ code }: TReplayCode) => {
3333

3434
if (isPlaying && replayTimeStamp && currentIndex < replayTimeStamp.length) {
3535
const currentTimestamp = replayTimeStamp[currentIndex];
36-
const nextTimestampDelay =
37-
currentIndex + 1 < replayTimeStamp.length
38-
? replayTimeStamp[currentIndex + 1].time - currentTimestamp.time
39-
: null;
36+
let nextTimestampDelay = 0;
37+
38+
if (currentIndex + 1 < replayTimeStamp.length) {
39+
nextTimestampDelay =
40+
replayTimeStamp[currentIndex + 1].time - currentTimestamp.time;
41+
} else {
42+
return;
43+
}
4044

4145
timeout = setTimeout(() => {
4246
setCurrentIndex(currentIndex + 1);
43-
}, nextTimestampDelay || currentTimestamp.time);
47+
}, nextTimestampDelay);
4448
}
4549

4650
return () => clearTimeout(timeout);

0 commit comments

Comments
 (0)