MCPcopy Index your code
hub / github.com/CodebuffAI/codebuff / useToast

Function useToast

web/src/components/ui/use-toast.ts:182–200  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

180}
181
182function useToast() {
183 const [state, setState] = React.useState<State>(memoryState)
184
185 React.useEffect(() => {
186 listeners.push(setState)
187 return () => {
188 const index = listeners.indexOf(setState)
189 if (index > -1) {
190 listeners.splice(index, 1)
191 }
192 }
193 }, [state])
194
195 return {
196 ...state,
197 toast,
198 dismiss: (toastId?: string) => dispatch({ type: 'DISMISS_TOAST', toastId }),
199 }
200}
201
202export { useToast, toast }

Callers 4

ToasterFunction · 0.90
ModelConfigSheetFunction · 0.90
SecuritySectionFunction · 0.90
ApiKeysSectionFunction · 0.90

Calls 1

dispatchFunction · 0.85

Tested by

no test coverage detected