MCPcopy
hub / github.com/vercel/next.js / heapPop

Function heapPop

packages/next/src/client/components/segment-cache/scheduler.ts:1792–1805  ·  view source on GitHub ↗
(heap: Array<PrefetchTask>)

Source from the content-addressed store, hash-verified

1790}
1791
1792function heapPop(heap: Array<PrefetchTask>): PrefetchTask | null {
1793 if (heap.length === 0) {
1794 return null
1795 }
1796 const first = heap[0]
1797 first._heapIndex = -1
1798 const last = heap.pop() as PrefetchTask
1799 if (last !== first) {
1800 heap[0] = last
1801 last._heapIndex = 0
1802 heapSiftDown(heap, last, 0)
1803 }
1804 return first
1805}
1806
1807function heapDelete(heap: Array<PrefetchTask>, node: PrefetchTask): void {
1808 const index = node._heapIndex

Callers 1

processQueueInMicrotaskFunction · 0.85

Calls 2

heapSiftDownFunction · 0.85
popMethod · 0.45

Tested by

no test coverage detected