FIX: Check `postStream.gaps` exists before trying `postSteam.gaps.after`

approved
#1

FIX: Check postStream.gaps exists before trying postSteam.gaps.after

diff --git a/app/assets/javascripts/discourse/lib/screen-track.js.es6 b/app/assets/javascripts/discourse/lib/screen-track.js.es6
index bc2d63d..a36b15c 100644
--- a/app/assets/javascripts/discourse/lib/screen-track.js.es6
+++ b/app/assets/javascripts/discourse/lib/screen-track.js.es6
@@ -115,6 +115,7 @@ export default class {
       !stream.canAppendMore && // We are at the end of the stream
       stream.posts.lastObject && // The last post exists
       stream.posts.lastObject.read && // The last post is read
+      stream.gaps && // The stream has gaps
       !!stream.gaps.after[stream.posts.lastObject.id] && // Stream ends with a gap
       stream.topic.last_read_post_number !==
         stream.posts.lastObject.post_number +

GitHub sha: 0ebe5ec1

1 Like
Approved #2