MCPcopy Create free account
hub / github.com/AnukarOP/claude-code-leaked / getSlowOperations

Function getSlowOperations

source code/bootstrap/state.ts:1597–1623  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

1595}> = []
1596
1597export function getSlowOperations(): ReadonlyArray<{
1598 operation: string
1599 durationMs: number
1600 timestamp: number
1601}> {
1602 // Most common case: nothing tracked. Return a stable reference so the
1603 // caller's setState() can bail via Object.is instead of re-rendering at 2fps.
1604 if (STATE.slowOperations.length === 0) {
1605 return EMPTY_SLOW_OPERATIONS
1606 }
1607 const now = Date.now()
1608 // Only allocate a new array when something actually expired; otherwise keep
1609 // the reference stable across polls while ops are still fresh.
1610 if (
1611 STATE.slowOperations.some(op => now - op.timestamp >= SLOW_OPERATION_TTL_MS)
1612 ) {
1613 STATE.slowOperations = STATE.slowOperations.filter(
1614 op => now - op.timestamp < SLOW_OPERATION_TTL_MS,
1615 )
1616 if (STATE.slowOperations.length === 0) {
1617 return EMPTY_SLOW_OPERATIONS
1618 }
1619 }
1620 // Safe to return directly: addSlowOperation() reassigns STATE.slowOperations
1621 // before pushing, so the array held in React state is never mutated.
1622 return STATE.slowOperations
1623}
1624
1625export function getMainThreadAgentType(): string | undefined {
1626 return STATE.mainThreadAgentType

Callers 1

DevBarFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected