You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
feat: surface specific changed prop/state/hook keys in profiling output (#32)
* feat: surface changed prop/state/hook keys in profiling output
Add ChangedKeys type carrying specific changed keys (props, state,
hooks) alongside cause type strings. This makes profiling output more
actionable by showing *which* props/state/hooks changed, not just
*that* they changed.
- Add ChangedKeys interface and changedKeys field to ComponentRenderReport
- Add extractChangedKeys helper and aggregate keys across commits in Profiler
- Include changedKeys in CommitDetail components
- Add formatChangedKeys helper and display keys in all profiling formatters
- Add tests for key aggregation, deduplication, and display
* chore: add changeset for changed keys feature
* docs: update profiling output examples with changed keys
When specific changed keys are available, a `changed:` suffix shows exactly which props, state keys, or hooks triggered the render (e.g. `changed: props: onClick, className state: count hooks: #0`).
Categories with no changes are omitted. Keys are deduplicated across commits in aggregate reports (`profile slow`, `profile rerenders`, `profile report`).
Copy file name to clipboardExpand all lines: packages/agent-react-devtools/skills/react-devtools/references/profiling-guide.md
+9-9Lines changed: 9 additions & 9 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -59,15 +59,15 @@ Once you identify a suspect, get its full render report:
59
59
agent-react-devtools profile report @c12
60
60
```
61
61
62
-
This shows all render causes. Common patterns:
62
+
This shows all render causes and the specific changed keys (e.g. `changed: props: onClick, className state: count`). Use the changed keys to pinpoint exactly what to stabilize or investigate. Common patterns:
63
63
64
-
| Cause | Meaning | Typical Fix |
65
-
|-------|---------|-------------|
66
-
|`parent-rendered`| Parent re-rendered, child has no bailout | Wrap child in `React.memo()`|
67
-
|`props-changed`| Received new prop references | Stabilize with `useMemo`/`useCallback` in parent |
68
-
|`state-changed`| Component's own state changed | Check if state update is necessary |
69
-
|`hooks-changed`| A hook dependency changed | Review hook dependencies|
70
-
|`first-mount`| Initial render | Normal — not a problem |
64
+
| Cause |Changed keys example |Meaning | Typical Fix |
|`parent-rendered`|_(none)_|Parent re-rendered, child has no bailout | Wrap child in `React.memo()`|
67
+
|`props-changed`|`props: onClick, style`|Received new prop references | Stabilize the listed props with `useMemo`/`useCallback` in parent |
68
+
|`state-changed`|`state: count, filter`|Component's own state changed | Check if the listed state updates are necessary |
69
+
|`hooks-changed`|`hooks: #0, #2`|A hook dependency changed | Review deps of the listed hooks (by index)|
70
+
|`first-mount`|_(none)_|Initial render | Normal — not a problem |
71
71
72
72
### 5. Inspect the Component
73
73
@@ -101,7 +101,7 @@ Compare render counts and durations to confirm improvement.
101
101
A parent component re-renders (e.g., from a timer or context change) and all children re-render because none use `React.memo`. Look for high re-render counts with `parent-rendered` cause.
102
102
103
103
### Unstable prop references
104
-
Parent passes `onClick={() => ...}` or `style={{...}}` inline — creates new references every render, defeating `memo()`. The child shows `props-changed` as the cause even though the values are semantically identical.
104
+
Parent passes `onClick={() => ...}` or `style={{...}}` inline — creates new references every render, defeating `memo()`. The child shows `props-changed` as the cause even though the values are semantically identical. The `changed:` output tells you exactly which props are the culprits (e.g. `changed: props: onClick, style`).
105
105
106
106
### Expensive computations without memoization
107
107
A component does heavy work (filtering, sorting, formatting) on every render. Shows up as high avg render time. Fix with `useMemo`.
0 commit comments