ag-common 0.0.539 → 0.0.540
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.
|
@@ -141,7 +141,8 @@ exports.Toast = Toast;
|
|
|
141
141
|
const ToastProvider = ({ children, providerOptions, }) => {
|
|
142
142
|
const [toasts, setToasts] = (0, react_1.useState)([]);
|
|
143
143
|
const addToast = (message, options) => setToasts((currentToasts) => [
|
|
144
|
-
...currentToasts
|
|
144
|
+
...currentToasts.filter((ct) => ct.message !== message ||
|
|
145
|
+
JSON.stringify(ct.options) !== JSON.stringify(options)),
|
|
145
146
|
{ id: (0, random_1.random)(10000).toString(), message, options },
|
|
146
147
|
]);
|
|
147
148
|
const close = (id) => setToasts((currentToasts) => currentToasts.filter((toast) => toast.id !== id));
|
package/package.json
CHANGED