Skip to content

Commit

Permalink
[newsfeed] getTemplateData: check activeItem index earlier
Browse files Browse the repository at this point in the history
  • Loading branch information
crazyscot committed Jan 13, 2024
1 parent 95c0b1b commit 4430012
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions modules/default/newsfeed/newsfeed.js
Original file line number Diff line number Diff line change
Expand Up @@ -118,6 +118,9 @@ Module.register("newsfeed", {

//Override template data and return whats used for the current template
getTemplateData () {
if (this.activeItem >= this.newsItems.length) {
this.activeItem = 0;
}
// this.config.showFullArticle is a run-time configuration, triggered by optional notifications
if (this.config.showFullArticle) {
return {
Expand All @@ -134,9 +137,6 @@ Module.register("newsfeed", {
empty: true
};
}
if (this.activeItem >= this.newsItems.length) {
this.activeItem = 0;
}

const item = this.newsItems[this.activeItem];
const items = this.newsItems.map(function (item) {
Expand Down

0 comments on commit 4430012

Please sign in to comment.