chore(dev): add React profiling and focused A/B workflows

This commit is contained in:
Tunglies
2026-11-03 19:24:31 +08:00
parent 2b7b7cc0e7
commit d2c6eafc9e
18 changed files with 965 additions and 3 deletions
+19
View File
@@ -0,0 +1,19 @@
import type { ProfilerOnRenderCallback } from 'react'
export type ProfileRecord = Parameters<ProfilerOnRenderCallback>
const records: ProfileRecord[] = []
export const recordRender: ProfilerOnRenderCallback = (...record) => {
if (records.length === 1000) records.shift()
records.push(record)
}
export const profiler = {
read: () => records.map((record) => [...record]),
clear: () => {
records.length = 0
},
}
Object.assign(window, { __CVR_REACT_PROFILER__: profiler })