refactor(editor): move the add-note dialog to src/add-note.js (R2, step 40) - #192
Merged
Conversation
…ep 40) Extract the add-note dialog (addNoteData state, showAddNote / hideAddNote, and the editorConfirmAddNote handler that commits an undoable AddNoteCmd) out of the src/main.js monolith into a new native ES module. The boot-teardown machinery that shared the "Add note dialog" banner stays in main.js. - src/add-note.js: showAddNote / hideAddNote are host hooks (main.js imports them; the existing thunk/shorthand host wiring resolves by name), plus 2 re-attached window handlers. addNoteData is exported as a live binding read by main.js's boot Enter-key handler across the module boundary. draw/updateStatus via host. - Removed 2 dead main.js imports (AddNoteCmd, noteToMidi). main.js drops ~53 lines. 41 modules. Verified: 90/90 JS suites pass, ESLint gate clean (0 errors), strict no-undef clean on add-note.js, Codex preflight 0 regressions. New headless harness double-clicks empty grid to open the dialog (proving showAddNote via the mouse host hook), confirms the default note (note count 3->4, proving editorConfirmAddNote + AddNoteCmd + host.draw), and undoes it (4->3) — zero page errors. Negative-checked. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Pro Plus Run ID: 📒 Files selected for processing (2)
📝 WalkthroughWalkthroughThe Add Note dialog implementation moves from ChangesAdd Note extraction
Estimated code review effort: 3 (Moderate) | ~20 minutes Possibly related PRs
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
Comment |
This was referenced Jul 11, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What
Step 40 of the R2 refactor: move the add-note dialog (
addNoteDatastate,showAddNote/hideAddNote, and theeditorConfirmAddNotehandler that commits an undoableAddNoteCmd) out ofsrc/main.jsinto a new native ES modulesrc/add-note.js. The boot-teardown machinery that shared the "Add note dialog" banner stays.How the seam is drawn
showAddNote/hideAddNoteare host hooks — main.js imports them (the existing thunk/shorthand host wiring resolves by name) — plus 2 re-attached window handlers.addNoteDatais exported as a live binding read by main.js's boot Enter-key handler across the module boundary.draw/updateStatusroute throughhost. Removed 2 dead main.js imports (AddNoteCmd,noteToMidi).main.js drops ~53 lines. 41 modules.
Verification
no-undefclean onadd-note.js.verify_add_note.py) double-clicks empty grid to open the dialog (provingshowAddNotevia the mouse host hook), confirms the default note (note count 3→4, provingeditorConfirmAddNote+AddNoteCmd+host.draw), and undoes it (4→3) — zero page errors. Negative-checked by dropping a re-attach.🤖 Generated with Claude Code
Summary by CodeRabbit