Summary
Hunk 0.10.0 crashes with "Maximum update depth exceeded" when the viewport is updated rapidly. Reproduces on both mode = "auto" and mode = "stack"; triggered by either scrolling or hunk-jumping (next/prev hunk navigation).
Version
0.10.0
Repro (either path)
hunk diff <range> on a diff with several hunks across multiple files
- Either: scroll continuously, OR press the next/prev-hunk key several times in quick succession
- Crash fires within a handful of inputs
Stack trace
Error: Maximum update depth exceeded. This can happen when a component repeatedly calls setState inside componentWillUpdate or componentDidUpdate. React limits the number of nested updates to prevent infinite loops.
at getRootForUpdatedFiber (/$bunfs/root/hunk:3318:131)
at dispatchSetStateInternal (/$bunfs/root/hunk:4544:45)
at dispatchSetState (/$bunfs/root/hunk:4515:31)
at <anonymous> (/$bunfs/root/hunk:90041:17)
at updateViewport (/$bunfs/root/hunk:90340:35)
at handleViewportChange (/$bunfs/root/hunk:90346:21)
at emit (node:events:95:22)
at onChange (/$bunfs/root/hunk:67289:18)
at value (/$bunfs/root/hunk:66967:23)
at updateSliderFromScrollState (/$bunfs/root/hunk:67374:16)
A second occurrence (different mode, scroll-triggered) had a near-identical chain with one extra frame:
at updateViewport (/$bunfs/root/hunk:90343:24)
at handleViewportChange (/$bunfs/root/hunk:90346:21)
at emit (node:events:95:22)
at onChange (/$bunfs/root/hunk:67289:18)
at value (/$bunfs/root/hunk:66967:23)
at updateSliderFromScrollState (/$bunfs/root/hunk:67374:16)
at scrollPosition (/$bunfs/root/hunk:67245:39)
Likely cause
The chain is slider state change → onChange → handleViewportChange → updateViewport (setState) → slider state change → .... Looks like a missing equality / source guard so a viewport update from the slider re-emits a slider update from the viewport on the same tick.
Workaround
None layout-side — happens in auto and stack alike. Navigate slowly between hunks; restart Hunk after a crash. (mode = "split" not yet ruled out.)
Summary
Hunk 0.10.0 crashes with "Maximum update depth exceeded" when the viewport is updated rapidly. Reproduces on both
mode = "auto"andmode = "stack"; triggered by either scrolling or hunk-jumping (next/prev hunk navigation).Version
0.10.0
Repro (either path)
hunk diff <range>on a diff with several hunks across multiple filesStack trace
A second occurrence (different mode, scroll-triggered) had a near-identical chain with one extra frame:
Likely cause
The chain is
slider state change → onChange → handleViewportChange → updateViewport (setState) → slider state change → .... Looks like a missing equality / source guard so a viewport update from the slider re-emits a slider update from the viewport on the same tick.Workaround
None layout-side — happens in
autoandstackalike. Navigate slowly between hunks; restart Hunk after a crash. (mode = "split"not yet ruled out.)