Repository navigation
Conversation
A tiny, UI-less entry point that taps into the same React DevTools profiling channel the Timeline Profiler uses. Streams commit / render / state-update events to a callback or POST endpoint, with optional per-fiber enrichment (changeDescription, source, fiberId, lane labels). Built on bippy primitives throughout. - New `react-scan/lite` export - Bumps bippy ^0.5.30 -> ^0.5.39 (uses traverseProps/State/Contexts, getFiberId, hasDebugSource, hasDebugStack, formatOwnerStack, parseStack, isRealReactDevtools, getRDTHook) - SSR-safe: instrument() returns a noop handle in Node - Emits profiling-hooks-status so agents know when mark* events won't fire (R19.2+ prod, non-__PROFILE__ builds) - Captures didError from React's onCommitFiberRoot 4th arg - Validates http(s) endpoint URL at instrument() time - 'use client' directive added to dist/lite/* and dist/core/* - 43 tests covering SSR, happy path, change-description, source, fiber identity, lane labels, chain forwarding, stop()/instrument() cycles, opt-out paths Tsconfig moduleResolution bumped to "bundler" to resolve bippy/source subpath; this also fixes pre-existing JSX namespace errors in web/components/copy-to-clipboard and web/views/notifications.
|
The latest updates on your projects. Learn more about Vercel for GitHub. 1 Skipped Deployment
|
commit: |
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes and found 1 potential issue.
❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.
Reviewed by Cursor Bugbot for commit cb602b6. Configure here.
| markRenderStarted: (lanes) => emitter.emit('render-start', { lanes }), | ||
| markRenderYielded: () => emitter.emit('render-yield'), | ||
| markRenderStopped: () => emitter.emit('render-stop'), | ||
| markRenderScheduled: (lane) => emitter.emit('render-scheduled', { lanes: lane }), |
There was a problem hiding this comment.
Disagree — leaving as lane (singular). markRenderScheduled, markStateUpdateScheduled, and markForceUpdateScheduled all receive a single just-scheduled lane from React's reconciler, not a bitmask. Compare to markRenderStarted(lanes) / markCommitStarted(lanes) which DO receive the full bitmask of lanes being rendered. The naming distinguishes API contracts. Bippy types both as Lanes (numeric alias) but the semantic distinction is real.
Bugbot caught: `isValidEndpointUrl()` only logged a warning but the invalid endpoint was still forwarded to `createEmitter`, so `canPostToEndpoint = Boolean(endpoint && sessionId)` evaluated true and every emit fired `fetch()` to e.g. `javascript:alert(1)` which failed silently per-event. Now we set `effectiveEndpoint = undefined` on validation failure before constructing the emitter. Adds a regression test that stubs `globalThis.fetch` and asserts no calls happen on commit when the endpoint is invalid.

Summary
Adds
react-scan/lite, a tiny UI-less entry point that taps into the same React DevTools profiling channel the Timeline Profiler uses. Pairs naturally with along-animation-framePerformanceObserverso an agent can attribute a slow LoAF to a specific component subtree.What's in the box
./litepackage export —dist/lite/index.{js,mjs,d.ts,d.mts}.getRDTHook,instrument,getDisplayName,getFiberId,traverseProps/State/Contexts,hasDebugSource,hasDebugStack,formatOwnerStack,parseStack,isRealReactDevtools. Re-exportsFiber,BundleType,Lanes,FiberSourcedirectly from bippy.recordChangeDescriptions—{ isFirstMount, props[], state, context, hooks[], parent }per fiber, ported from React DevTools'getChangeDescription.includeFiberSource—{ source, ownerName }from_debugSource(R16/17/18) or_debugStack(R19+), sync-only.includeFiberIdentity— alternate-aware monotonicfiberIdvia bippy'sgetFiberId.includeLaneLabels(default on) — translateslanesbitmask to["SyncLane", "DefaultLane"]andpriorityLevelto"UserBlocking".profiling-hooks-statusevent — emits{ available, reason, error?, reactVersion, bundleType }so an agent knows whenmark*events won't fire instead of silently concluding "idle".keepalive: true. URL validated atinstrument()time.instrument()returns a noop handle in Node; nowindow/document/fetch/navigatoraccess.isRealReactDevtoolsand warns once thatinjectProfilingHooksis a hard replace.Bippy bump
^0.5.30→^0.5.39. Required forbippy/sourcesubpath exports and thetraverseProps/State/Contextshelpers used by the change-description port.Tsconfig change
packages/scan/tsconfig.jsonnow sets"module": "ESNext"+"moduleResolution": "bundler". Required to resolve bippy's./sourcesubpath export. Side benefit: fixes pre-existingCannot find namespace 'JSX'errors inweb/components/copy-to-clipboard/index.tsxandweb/views/notifications/collapsed-event.tsx.Build pipeline
tsup.config.tsaddDirectivesToChunkFilesnow runs againstdist/,dist/lite/, anddist/core/. Confirmed'use client'lands ondist/lite/index.{js,mjs}and does NOT land ondist/react-component-name/*(those are bundler plugins).README
Removed the two stale "monitor issues in production / React Scan Monitoring" callouts. Added a
react-scan/lite: headless instrumentationsection with the options table and thereact-dom/profilingopt-in for production attribution.Test plan
pnpm test src/lite/lite.test.ts— 43 tests pass:node -e)node -e)maxFibersPerCommit,minFiberActualDurationMs, warn on endpoint-without-sessionId, profiling-hooks-status (no-method/threw/opted-out), lane label translation, priorityName, fiberId stability, changeDescription (isFirstMount + parent cascade + context change + class state + hook state), source + ownerName, fiber-source null fallback, priorityName withoutgetLaneLabelMap, TDZ regression, chain forwarding, didError capture, error message capture,includeFiberTree: falsewarning, invalid endpoint URL warning, emit fast-path, cascade rejects zero-duration ancestors, double-attach prevention, stop from inside listenerpnpm typecheck— 0 errorspnpm exec oxlint src/lite— 0 warnings, 0 errorspnpm build—dist/lite/index.{js,mjs,d.ts,d.mts}generated with'use client'directiveNote
Medium Risk
Adds a new runtime instrumentation entry point that patches the React DevTools global hook and can optionally POST profiling data to an endpoint, which could affect app behavior/perf or interfere with DevTools if misused. Changes also touch the build/TS config and dependency versions, so packaging/compatibility regressions are possible.
Overview
Introduces
react-scan/lite, a new headless instrumentation export that attaches to the React DevTools profiling channel to emit commit/render/update events, optionally walking the fiber tree and enriching it with change attribution, source/owner info, stable fiber IDs, lane/priority labels, anddidError.Adds an event emitter with
subscribe()and optionalfetchPOST ingest (with one-time endpoint URL validation), plus lifecycle handling (stop()restores prior hook handlers) and SSR-safe no-op behavior. Updates packaging/build config to ship the new./liteexport (tsup entry +'use client'directive handling), bumpsbippy, adjusts TS module resolution forbippy/source, and documentsliteusage in the README with a comprehensive new test suite for the module.Reviewed by Cursor Bugbot for commit c398c10. Bugbot is set up for automated code reviews on this repo. Configure here.