toastflow-core 0.0.2 → 0.0.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +3 -1
- package/src/store.ts +7 -16
package/package.json
CHANGED
package/src/store.ts
CHANGED
|
@@ -673,27 +673,18 @@ function pickOverflowToast(
|
|
|
673
673
|
return null;
|
|
674
674
|
}
|
|
675
675
|
|
|
676
|
-
const
|
|
676
|
+
const first = samePos[0];
|
|
677
677
|
if (!first) {
|
|
678
678
|
return null;
|
|
679
679
|
}
|
|
680
680
|
|
|
681
681
|
if (order === "newest") {
|
|
682
|
-
|
|
683
|
-
|
|
684
|
-
|
|
685
|
-
oldest = t;
|
|
686
|
-
}
|
|
687
|
-
}
|
|
688
|
-
return oldest;
|
|
689
|
-
}
|
|
690
|
-
|
|
691
|
-
let newest = first;
|
|
692
|
-
for (const t of rest) {
|
|
693
|
-
if (t.createdAt > newest.createdAt) {
|
|
694
|
-
newest = t;
|
|
695
|
-
}
|
|
682
|
+
return samePos.slice(1).reduce((oldest, toast) => {
|
|
683
|
+
return toast.createdAt < oldest.createdAt ? toast : oldest;
|
|
684
|
+
}, first);
|
|
696
685
|
}
|
|
697
686
|
|
|
698
|
-
return newest
|
|
687
|
+
return samePos.slice(1).reduce((newest, toast) => {
|
|
688
|
+
return toast.createdAt > newest.createdAt ? toast : newest;
|
|
689
|
+
}, first);
|
|
699
690
|
}
|