MCPcopy Create free account
hub / github.com/TanStack/ai / removeHookRecord

Function removeHookRecord

packages/ai-devtools/src/store/hook-registry.ts:615–639  ·  view source on GitHub ↗
(state: HookRegistryState, hookId: string)

Source from the content-addressed store, hash-verified

613}
614
615function removeHookRecord(state: HookRegistryState, hookId: string): void {
616 const hook = state.hooks[hookId]
617 const hookRunIds = new Set(hook?.runIds ?? [])
618 const hookEventIds = new Set(hook?.eventIds ?? [])
619
620 for (const [runId, run] of Object.entries(state.runs)) {
621 if (run.hookId === hookId || hookRunIds.has(runId)) {
622 delete state.runs[runId]
623 }
624 }
625
626 // Only remove events that were attached to the hook via attachEventToHook;
627 // the unregister event itself is intentionally not attached so it survives
628 // and can still be inspected on the global timeline.
629 for (const eventId of hookEventIds) {
630 delete state.events[eventId]
631 }
632
633 delete state.hooks[hookId]
634 delete state.seenHookActivityCounts[hookId]
635
636 if (state.activeHookId === hookId) {
637 state.activeHookId = null
638 }
639}
640
641function upsertRun(
642 state: HookRegistryState,

Callers 1

applyHookEventFunction · 0.85

Calls 1

hasMethod · 0.80

Tested by

no test coverage detected