Fix: Create tests for issue #2 #7
Reference in New Issue
Block a user
Delete Branch "claude/issue-6"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Summary
Adds a dedicated regression test suite for the stale-closure bug fixed in issue #2 (PR #3).
What was the bug (issue #2)?
The
createPathSegmentfunction inGraph.tsxbuilt breadcrumbonClickhandlers that closed over thegraphsPathvariable captured at render time. After further navigation, that closure became stale:findIndexreturned-1andsplice(0)wiped the entire breadcrumb array, making all breadcrumbs disappear.The fix (commit
eb3a23a) switched to the functional updater form ofsetGraphsPathsofindIndexalways runs against the current state.What this PR adds
A new
describeblock "Stale-closure regression (issue #2)" ine2e/breadcrumb.spec.tswith four targeted tests:slice(0, 0)could clear the array.All four tests would fail against the pre-fix code and pass against the fixed code.
Closes #6