MCPcopy
hub / github.com/claude-code-best/claude-code / resetAfterCommit

Function resetAfterCommit

packages/@ant/ink/src/core/reconciler.ts:264–322  ·  view source on GitHub ↗
(rootNode)

Source from the content-addressed store, hash-verified

262 preparePortalMount: () => null,
263 clearContainer: () => false,
264 resetAfterCommit(rootNode) {
265 _lastCommitMs = _commitStart > 0 ? performance.now() - _commitStart : 0
266 _commitStart = 0
267 if (COMMIT_LOG) {
268 const now = performance.now()
269 _commits++
270 const gap = _lastCommitAt > 0 ? now - _lastCommitAt : 0
271 if (gap > _maxGapMs) _maxGapMs = gap
272 _lastCommitAt = now
273 const reconcileMs = _prepareAt > 0 ? now - _prepareAt : 0
274 if (gap > 30 || reconcileMs > 20 || _createCount > 50) {
275 debugLog(
276 `${now.toFixed(1)} gap=${gap.toFixed(1)}ms reconcile=${reconcileMs.toFixed(1)}ms creates=${_createCount}`,
277 )
278 }
279 _createCount = 0
280 if (now - _lastLog > 1000) {
281 debugLog(
282 `${now.toFixed(1)} commits=${_commits}/s maxGap=${_maxGapMs.toFixed(1)}ms`,
283 )
284 _commits = 0
285 _maxGapMs = 0
286 _lastLog = now
287 }
288 }
289 const _t0 = COMMIT_LOG ? performance.now() : 0
290 if (typeof rootNode.onComputeLayout === 'function') {
291 rootNode.onComputeLayout()
292 }
293 if (COMMIT_LOG) {
294 const layoutMs = performance.now() - _t0
295 if (layoutMs > 20) {
296 const c = getYogaCounters()
297 debugLog(
298 `${_t0.toFixed(1)} SLOW_YOGA ${layoutMs.toFixed(1)}ms visited=${c.visited} measured=${c.measured} hits=${c.cacheHits} live=${c.live}`,
299 )
300 }
301 }
302
303 if (process.env.NODE_ENV === 'test') {
304 if (rootNode.childNodes.length === 0 && rootNode.hasRenderedContent) {
305 return
306 }
307 if (rootNode.childNodes.length > 0) {
308 rootNode.hasRenderedContent = true
309 }
310 rootNode.onImmediateRender?.()
311 return
312 }
313
314 const _tr = COMMIT_LOG ? performance.now() : 0
315 rootNode.onRender?.()
316 if (COMMIT_LOG) {
317 const renderMs = performance.now() - _tr
318 if (renderMs > 10) {
319 debugLog(`${_tr.toFixed(1)} SLOW_PAINT ${renderMs.toFixed(1)}ms`)
320 }
321 }

Callers

nothing calls this directly

Calls 4

debugLogFunction · 0.85
getYogaCountersFunction · 0.85
nowMethod · 0.80
onRenderMethod · 0.80

Tested by

no test coverage detected