MCPcopy Create free account
hub / github.com/codeaashu/claude-code / useStartupNotification

Function useStartupNotification

src/hooks/notifs/useStartupNotification.ts:19–41  ·  view source on GitHub ↗
(
  compute: () => Result | Promise<Result>,
)

Source from the content-addressed store, hash-verified

17 * Rejections are routed to logError.
18 */
19export function useStartupNotification(
20 compute: () => Result | Promise<Result>,
21): void {
22 const { addNotification } = useNotifications()
23 const hasRunRef = useRef(false)
24 const computeRef = useRef(compute)
25 computeRef.current = compute
26
27 useEffect(() => {
28 if (getIsRemoteMode() || hasRunRef.current) return
29 hasRunRef.current = true
30
31 void Promise.resolve()
32 .then(() => computeRef.current())
33 .then(result => {
34 if (!result) return
35 for (const n of Array.isArray(result) ? result : [result]) {
36 addNotification(n)
37 }
38 })
39 .catch(logError)
40 }, [addNotification])
41}
42

Calls 3

getIsRemoteModeFunction · 0.85
useNotificationsFunction · 0.50
resolveMethod · 0.45

Tested by

no test coverage detected