MCPcopy Create free account
hub / github.com/sourcebot-dev/sourcebot / addToRemoveQueue

Function addToRemoveQueue

packages/web/src/components/hooks/use-toast.ts:61–75  ·  view source on GitHub ↗
(toastId: string)

Source from the content-addressed store, hash-verified

59const toastTimeouts = new Map<string, ReturnType<typeof setTimeout>>()
60
61const addToRemoveQueue = (toastId: string) => {
62 if (toastTimeouts.has(toastId)) {
63 return
64 }
65
66 const timeout = setTimeout(() => {
67 toastTimeouts.delete(toastId)
68 dispatch({
69 type: "REMOVE_TOAST",
70 toastId: toastId,
71 })
72 }, TOAST_REMOVE_DELAY)
73
74 toastTimeouts.set(toastId, timeout)
75}
76
77export const reducer = (state: State, action: Action): State => {
78 switch (action.type) {

Callers 1

reducerFunction · 0.85

Calls 1

dispatchFunction · 0.85

Tested by

no test coverage detected