@unitedstatespowersquadrons/components 1.2.12 → 1.2.13
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/Toasts/toastHelpers.ts +4 -4
- package/Toasts/types.ts +1 -0
- package/package.json +1 -1
package/Toasts/toastHelpers.ts
CHANGED
|
@@ -19,13 +19,13 @@ export function handleToasts<T extends AppStateWithToasts>(draft: Draft<T>, toas
|
|
|
19
19
|
}
|
|
20
20
|
|
|
21
21
|
export function addToast<T extends AppStateWithToasts>(draft: Draft<T>, toastOptions: Toast) {
|
|
22
|
-
const { body, status, timeout, title } = toastOptions;
|
|
22
|
+
const { body, id, status, timeout, title } = toastOptions;
|
|
23
23
|
|
|
24
24
|
// Increment current toastId to prevent collisions
|
|
25
|
-
const
|
|
26
|
-
draft.toastId =
|
|
25
|
+
const toastId = draft.toastId ? draft.toastId + 1 : 1;
|
|
26
|
+
draft.toastId = toastId;
|
|
27
27
|
|
|
28
|
-
const toast = { body, id, status, timeout, title } as ToastProps;
|
|
28
|
+
const toast = { body, id: id || toastId, status, timeout, title } as ToastProps;
|
|
29
29
|
|
|
30
30
|
// Initialize toasts array if not provided by the server
|
|
31
31
|
if (!draft.toasts) draft.toasts = [];
|
package/Toasts/types.ts
CHANGED