Skip to content

Commit

Permalink
fix(update): update when length of notifications changed
Browse files Browse the repository at this point in the history
  • Loading branch information
finnp committed Mar 24, 2018
1 parent 2be814c commit 1981a1d
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion main.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ class Notifications extends Nanocomponent {

this.getMessageBody = this.getMessageBody.bind(this)
this.notifications = []
this.renderedLength = -1
}

add (notification) {
Expand Down Expand Up @@ -58,6 +59,7 @@ class Notifications extends Nanocomponent {

createElement (notifications) {
if (notifications) this.notifications = notifications
this.renderedLength = notifications.length
return html`<div class="notification-container">${
notifications
.map((notification) => {
Expand All @@ -84,7 +86,7 @@ class Notifications extends Nanocomponent {
}

update (notifications) {
return notifications !== this.notifications
return notifications !== this.notifications || notifications.length !== this.renderedLength
}
}

Expand Down

0 comments on commit 1981a1d

Please sign in to comment.