fix(tools): support contour segmentation undo and redo#2817
Conversation
|
Caution Review failedThe pull request is closed. ℹ️ Recent review info⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Pro Plus Run ID: 📒 Files selected for processing (7)
📝 WalkthroughWalkthroughAdds ChangesContour history
Estimated code review effort: 4 (Complex) | ~45 minutes Sequence Diagram(s)sequenceDiagram
participant User
participant applyStroke
participant DefaultHistoryMemo
participant AnnotationState
User->>applyStroke: draw contour stroke
applyStroke->>AnnotationState: create merged annotations
applyStroke->>DefaultHistoryMemo: replace current memo
User->>DefaultHistoryMemo: undo or redo
DefaultHistoryMemo->>AnnotationState: restore previous or resulting annotations
Possibly related PRs
Suggested reviewers: ✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
Claude Code Review
Claude Code Review is paused for this repository. To reconnect it, an admin of this repository's GitHub organization (or the account owner, for personal repositories) who can also manage your Claude organization's Code Review settings needs to re-link GitHub in Code Review settings. This is a one-time step.
Tip: disable this comment in your organization's Code Review settings.
* fix(cornerstone): bump cornerstone3D to 5.6.8 Bumps all @cornerstonejs/* packages 5.6.7 -> 5.6.8: contour segmentation undo/redo fix (cornerstonejs/cornerstone3D#2817) * fix(deps): pin adm-zip to 0.6.0 dcmjs pins adm-zip 0.5.17 but does not import it in runtime code; 0.6.0 patches GHSA-xcpc-8h2w-3j85, which trips the lockfile audit gate on any lockfile-touching PR.
Summary
RenderBackendsenum nameRoot cause
The planar freehand tool initially records an annotation-creation memo for the source stroke. Contour boolean processing then removes that source annotation and rebuilds the resulting contour annotations, leaving the memo pointed at an annotation that no longer exists. Undo therefore could not remove the committed contour, and redo could restore the obsolete source stroke.
This change replaces that provisional memo in-place with a memo that swaps the complete pre-stroke and post-stroke annotation sets, preserving a single undo step for creation, merges, and holes.
Validation
corepack pnpm run test:vitest:browser tests/vitest-browser/undoRedoHistory.browser.test.ts— 9 passed, 1 expected failurecorepack pnpm exec jest packages/core/test/utilities/historyMemo.jest.js --runInBand— 5 passedcorepack pnpm exec tsc --project packages/core/tsconfig.jsoncorepack pnpm exec tsc --project packages/tools/tsconfig.jsongit diff --checkSummary by CodeRabbit
New Features
Bug Fixes