MCPcopy Index your code
hub / github.com/codeaashu/claude-code / resetAfterCommit

Function resetAfterCommit

src/ink/reconciler.ts:247–315  ·  view source on GitHub ↗
(rootNode)

Source from the content-addressed store, hash-verified

245 preparePortalMount: () => null,
246 clearContainer: () => false,
247 resetAfterCommit(rootNode) {
248 _lastCommitMs = _commitStart > 0 ? performance.now() - _commitStart : 0
249 _commitStart = 0
250 if (COMMIT_LOG) {
251 const now = performance.now()
252 _commits++
253 const gap = _lastCommitAt > 0 ? now - _lastCommitAt : 0
254 if (gap > _maxGapMs) _maxGapMs = gap
255 _lastCommitAt = now
256 const reconcileMs = _prepareAt > 0 ? now - _prepareAt : 0
257 if (gap > 30 || reconcileMs > 20 || _createCount > 50) {
258 // eslint-disable-next-line custom-rules/no-sync-fs -- debug instrumentation
259 appendFileSync(
260 COMMIT_LOG,
261 `${now.toFixed(1)} gap=${gap.toFixed(1)}ms reconcile=${reconcileMs.toFixed(1)}ms creates=${_createCount}\n`,
262 )
263 }
264 _createCount = 0
265 if (now - _lastLog > 1000) {
266 // eslint-disable-next-line custom-rules/no-sync-fs -- debug instrumentation
267 appendFileSync(
268 COMMIT_LOG,
269 `${now.toFixed(1)} commits=${_commits}/s maxGap=${_maxGapMs.toFixed(1)}ms\n`,
270 )
271 _commits = 0
272 _maxGapMs = 0
273 _lastLog = now
274 }
275 }
276 const _t0 = COMMIT_LOG ? performance.now() : 0
277 if (typeof rootNode.onComputeLayout === 'function') {
278 rootNode.onComputeLayout()
279 }
280 if (COMMIT_LOG) {
281 const layoutMs = performance.now() - _t0
282 if (layoutMs > 20) {
283 const c = getYogaCounters()
284 // eslint-disable-next-line custom-rules/no-sync-fs -- debug instrumentation
285 appendFileSync(
286 COMMIT_LOG,
287 `${_t0.toFixed(1)} SLOW_YOGA ${layoutMs.toFixed(1)}ms visited=${c.visited} measured=${c.measured} hits=${c.cacheHits} live=${c.live}\n`,
288 )
289 }
290 }
291
292 if (process.env.NODE_ENV === 'test') {
293 if (rootNode.childNodes.length === 0 && rootNode.hasRenderedContent) {
294 return
295 }
296 if (rootNode.childNodes.length > 0) {
297 rootNode.hasRenderedContent = true
298 }
299 rootNode.onImmediateRender?.()
300 return
301 }
302
303 const _tr = COMMIT_LOG ? performance.now() : 0
304 rootNode.onRender?.()

Callers

nothing calls this directly

Calls 3

appendFileSyncFunction · 0.90
getYogaCountersFunction · 0.85
onRenderMethod · 0.45

Tested by

no test coverage detected