@unitedstatespowersquadrons/components 1.2.35 → 1.2.36

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.
@@ -43,22 +43,7 @@ export function addToast<T extends AppStateWithToasts>(draft: Draft<T>, toastOpt
43
43
  }
44
44
 
45
45
  export function removeToast<T extends AppStateWithToasts>(draft: Draft<T>, toast: ToastProps) {
46
- const beforeToasts: ToastProps[] = [];
47
- const afterToasts: ToastProps[] = [];
48
- let beforeToast = true;
49
-
50
- // draft.toasts.splice was removing toasts too quickly
51
- draft.toasts.forEach(t => {
52
- if (t === toast) {
53
- beforeToast = false;
54
- } else if (beforeToast) {
55
- beforeToasts.push(t);
56
- } else {
57
- afterToasts.push(t);
58
- }
59
-
60
- draft.toasts = beforeToasts.concat(afterToasts);
61
- });
46
+ draft.toasts = draft.toasts.filter(t => t !== toast);
62
47
  }
63
48
 
64
49
  export function removeToastById<T extends AppStateWithToasts>(draft: Draft<T>, toastId: number) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@unitedstatespowersquadrons/components",
3
- "version": "1.2.35",
3
+ "version": "1.2.36",
4
4
  "description": "USPS shared React components library",
5
5
  "main": "index.tsx",
6
6
  "scripts": {