({ ...props })
| 82 | }); |
| 83 | } |
| 84 | function toast({ ...props }) { |
| 85 | const id = genId(); |
| 86 | const update = (props2) => dispatch({ |
| 87 | type: "UPDATE_TOAST", |
| 88 | toast: { ...props2, id } |
| 89 | }); |
| 90 | const dismiss = () => dispatch({ type: "DISMISS_TOAST", toastId: id }); |
| 91 | dispatch({ |
| 92 | type: "ADD_TOAST", |
| 93 | toast: { |
| 94 | ...props, |
| 95 | id, |
| 96 | open: true, |
| 97 | onOpenChange: (open) => { |
| 98 | if (!open) dismiss(); |
| 99 | } |
| 100 | } |
| 101 | }); |
| 102 | return { |
| 103 | id, |
| 104 | dismiss, |
| 105 | update |
| 106 | }; |
| 107 | } |
| 108 | function useToast() { |
| 109 | const [state, setState] = React.useState(memoryState); |
| 110 | React.useEffect(() => { |
no test coverage detected