MCPcopy Create free account
hub / github.com/arctic-cli/interface / showPromiseToast

Function showPromiseToast

packages/ui/src/components/toast.tsx:141–160  ·  view source on GitHub ↗
(
  promise: Promise<T> | (() => Promise<T>),
  options: ToastPromiseOptions<T, U>,
)

Source from the content-addressed store, hash-verified

139}
140
141export function showPromiseToast<T, U = unknown>(
142 promise: Promise<T> | (() => Promise<T>),
143 options: ToastPromiseOptions<T, U>,
144) {
145 return toaster.promise(promise, (props) => (
146 <Toast
147 toastId={props.toastId}
148 data-variant={props.state === "pending" ? "loading" : props.state === "fulfilled" ? "success" : "error"}
149 >
150 <Toast.Content>
151 <Toast.Description>
152 {props.state === "pending" && options.loading}
153 {props.state === "fulfilled" && options.success?.(props.data!)}
154 {props.state === "rejected" && options.error?.(props.error)}
155 </Toast.Description>
156 </Toast.Content>
157 <Toast.CloseButton />
158 </Toast>
159 ))
160}

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected