/** * @license * Copyright 2026 Aglyn LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ /** * WHAT A KEYSTROKE ACTUALLY RE-RENDERED, read off React's own commits * (AGL-3423). * * A keystroke that re-renders a whole dialog is cheap to write and expensive * to run, and it is the cost that matters: when each keystroke takes long * enough, typed input queues up and is processed back to back, and a chip * Autocomplete re-rendered by every one of them leaves React's nested-update * count climbing until it throws #185. A spec can only hold that line if it * can SEE it, so this counts it, the way React DevTools' "why did this * render" does: a stand-in devtools hook receives every committed tree, and * a walk that skips each subtree React bailed out of counts the components * whose functions ran. * * The hook is read when `react-dom` is first evaluated, so install it, then * `jest.resetModules()`, then require React, `react-dom/client` and the * component under test from the fresh registry. */ /** * The time a spec built on this needs, per test and per setup hook: each * loads React, MUI and the component under test into a fresh registry, which * on a loaded two-worker CI shard ran past jest's 30 s default (2026-09-30). * Set it file-wide with `jest.setTimeout`. */ export declare const FRESH_REGISTRY_TIMEOUT_MS = 120000; export interface FiberRenderCounter { /** How many times each named component rendered since the last reset. */ rendered(name: string): number; /** Every name counted since the last reset, for a failure message. */ snapshot(): Record; reset(): void; uninstall(): void; } /** Installs the counting hook; `react-dom` must be required after this. */ export declare function installFiberRenderCounter(): FiberRenderCounter;