Fix toast priority sorting to put the highest priority into slot[0]

Signed-off-by: Michael Telatynski <7t3chguy@gmail.com>
pull/21833/head
Michael Telatynski 2020-05-22 22:03:16 +01:00
parent 3732d1f5a5
commit 89292ca47b
1 changed files with 1 additions and 1 deletions

View File

@ -55,7 +55,7 @@ export default class ToastStore extends EventEmitter {
const oldIndex = this.toasts.findIndex(t => t.key === newToast.key); const oldIndex = this.toasts.findIndex(t => t.key === newToast.key);
if (oldIndex === -1) { if (oldIndex === -1) {
let newIndex = this.toasts.length; let newIndex = this.toasts.length;
while (newIndex > 0 && this.toasts[newIndex - 1].priority > newToast.priority) --newIndex; while (newIndex > 0 && this.toasts[newIndex - 1].priority < newToast.priority) --newIndex;
this.toasts.splice(newIndex, 0, newToast); this.toasts.splice(newIndex, 0, newToast);
} else { } else {
this.toasts[oldIndex] = newToast; this.toasts[oldIndex] = newToast;