toastflow-core 0.0.1 → 0.0.2
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 +1 -1
- package/src/store.ts +9 -4
package/package.json
CHANGED
package/src/store.ts
CHANGED
|
@@ -673,9 +673,14 @@ function pickOverflowToast(
|
|
|
673
673
|
return null;
|
|
674
674
|
}
|
|
675
675
|
|
|
676
|
+
const [first, ...rest] = samePos;
|
|
677
|
+
if (!first) {
|
|
678
|
+
return null;
|
|
679
|
+
}
|
|
680
|
+
|
|
676
681
|
if (order === "newest") {
|
|
677
|
-
let oldest =
|
|
678
|
-
for (const t of
|
|
682
|
+
let oldest = first;
|
|
683
|
+
for (const t of rest) {
|
|
679
684
|
if (t.createdAt < oldest.createdAt) {
|
|
680
685
|
oldest = t;
|
|
681
686
|
}
|
|
@@ -683,8 +688,8 @@ function pickOverflowToast(
|
|
|
683
688
|
return oldest;
|
|
684
689
|
}
|
|
685
690
|
|
|
686
|
-
let newest =
|
|
687
|
-
for (const t of
|
|
691
|
+
let newest = first;
|
|
692
|
+
for (const t of rest) {
|
|
688
693
|
if (t.createdAt > newest.createdAt) {
|
|
689
694
|
newest = t;
|
|
690
695
|
}
|