Prompt Details
Model
(claude-5-opus)
Token size
299
Example input
[ERROR MESSAGE]: Dashboard component re-renders continuously and pegs CPU whenever filters.dateRange is set
[RELEVANT CODE]: useEffect(function() { load(filters) }, buildDeps(filters)) - buildDeps returns a brand new array every render because the filters object is rebuilt from the date pickers on each render
[WHAT YOU'VE ALREADY TRIED]: Confirmed the store subscription's own dependency array is correct and not the cause
Example output
1. Restate: The Dashboard component re-renders continuously, pegging CPU, whenever filters.dateRange is set.
2. Candidate causes, ranked: (a) useEffect depends on the filters object itself, which is a new object reference every render - supported by filters being rebuilt inline in the parent as {...defaultFilters, ...override}. (b) A child component calls setFilters inside its own render body instead of an event handler. (c) useMemo for filteredRows is missing a dependency, causing a state update loop through a subscribed store.
3. Tests: (a) log filters === prevFilters each render - false every time confirms a new reference. (b) grep for setFilters( outside handlers and effects. (c) check the store subscription's dependency array.
4. Most likely: (a) - the log shows filters is a new object every render even when the underlying values are unchanged, and the parent builds it inline on every render.
5. Fix: memoize filters in the parent with useMemo keyed on the primitive values (start, end), not the wrapper object, or change the effect's dependency to the primitive values directly.
6. Ruled out (c): the store subscription's dependency array was already correct on inspection.
By purchasing this prompt, you agree to our terms of service
CLAUDE-5-OPUS
Stop patching symptoms. This Claude prompt walks through systematic root-cause analysis for any bug: reproduces the failure pattern, generates competing hypotheses, tests them one at a time against your evidence, and traces the fault to its true origin before proposing a fix. Paste your error message, relevant logs, and the suspect code to get a structured diagnosis with a ranked list of causes instead of a guess. Built for developers who are tired of fixes that don't stick.
...more
Added 6 days ago
