MCPcopy
hub / github.com/fosrl/pangolin / toast

Function toast

src/hooks/useToast.ts:142–169  ·  view source on GitHub ↗
({ ...props }: Toast)

Source from the content-addressed store, hash-verified

140type Toast = Omit<ToasterToast, "id">;
141
142function toast({ ...props }: Toast) {
143 const id = genId();
144
145 const update = (props: ToasterToast) =>
146 dispatch({
147 type: "UPDATE_TOAST",
148 toast: { ...props, id }
149 });
150 const dismiss = () => dispatch({ type: "DISMISS_TOAST", toastId: id });
151
152 dispatch({
153 type: "ADD_TOAST",
154 toast: {
155 ...props,
156 id,
157 open: true,
158 onOpenChange: (open) => {
159 if (!open) dismiss();
160 }
161 }
162 });
163
164 return {
165 id: id,
166 dismiss,
167 update
168 };
169}
170
171function useToast() {
172 const [state, setState] = React.useState<State>(memoryState);

Callers 15

refreshDataFunction · 0.90
removeUserFunction · 0.90
refreshDataFunction · 0.90
deleteLabelFunction · 0.90
deleteIdpFunction · 0.90
importIdpFunction · 0.90
unassociateIdpFunction · 0.90
refreshDataFunction · 0.90
deleteSharelinkFunction · 0.90
onSubmitFunction · 0.90
refreshDataFunction · 0.90
deleteSiteFunction · 0.90

Calls 3

genIdFunction · 0.85
dispatchFunction · 0.85
dismissFunction · 0.85

Tested by

no test coverage detected