Skip to content

refactor: remove unused useUndoRedo hook#602

Open
Shubh-Raj wants to merge 7 commits intoaccordproject:mainfrom
Shubh-Raj:shubhraj/cleanup/remove-unused-undoredo
Open

refactor: remove unused useUndoRedo hook#602
Shubh-Raj wants to merge 7 commits intoaccordproject:mainfrom
Shubh-Raj:shubhraj/cleanup/remove-unused-undoredo

Conversation

@Shubh-Raj
Copy link
Contributor

Closes #601

Removes the unused useUndoRedo hook that became dead code after commit 61f3865 removed the undo/redo UI buttons during a UI refactor. Monaco Editor handles native Ctrl+Z/Ctrl+Y, making this hook redundant.

Changes

  • Delete src/components/useUndoRedo.ts (47 lines)
  • Simplify TemplateModel.tsx to use store state directly
  • Simplify TemplateMarkdown.tsx to use store state directly
  • Simplify AgreementData.tsx to use store state directly

Flags

  • This is a cleanup/refactor PR with no functional changes
  • Monaco Editor's native undo/redo (Ctrl+Z/Ctrl+Y) continues to work as expected

Screenshots or Video

N/A - No visual changes

Related Issues

  • Original feature added in commit 622297c (Mar 2025)
  • UI buttons removed in commit 61f3865 (Aug 2025)

Author Checklist

  • Ensure you provide a DCO sign-off for your commits using the --signoff option of git commit.
  • Vital features and changes captured in unit and/or integration tests
  • Commits messages follow AP format
  • Extend the documentation, if necessary
  • Merging to main from fork:branchname

The useUndoRedo hook was originally added with undo/redo UI buttons but
the buttons were accidentally removed during a UI refactor in commit
61f3865. Since Monaco Editor handles native Ctrl+Z/Ctrl+Y, this hook
became redundant dead code.

Changes:
- Delete src/components/useUndoRedo.ts
- Simplify editor components to use store state directly

Signed-off-by: Shubh-Raj <shubhraj625@gmail.com>
@Shubh-Raj Shubh-Raj requested a review from a team as a code owner January 19, 2026 14:21
@netlify
Copy link

netlify bot commented Jan 19, 2026

Deploy Preview for ap-template-playground ready!

Name Link
🔨 Latest commit 1cb30a6
🔍 Latest deploy log https://app.netlify.com/projects/ap-template-playground/deploys/69a80335575d0d00081d9a94
😎 Deploy Preview https://deploy-preview-602--ap-template-playground.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify project configuration.

@Shubh-Raj
Copy link
Contributor Author

If the undo/redo buttons are needed in the editors, I'd be happy to implement them instead. Just let me know!

@Shubh-Raj
Copy link
Contributor Author

Resolved the merge conflicts.

Copilot AI review requested due to automatic review settings March 3, 2026 06:30
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Removes the now-dead useUndoRedo hook and updates the editor container components to read/write editor state directly from the Zustand store, relying on Monaco’s native undo/redo behavior.

Changes:

  • Deleted src/components/useUndoRedo.ts (no remaining references found).
  • Refactored TemplateModel, TemplateMarkdown, and AgreementData to pass store-backed editor values directly to their editors.
  • Simplified change handlers to update editor* state and trigger rebuild via the corresponding async store setters.

Reviewed changes

Copilot reviewed 4 out of 4 changed files in this pull request and generated no comments.

File Description
src/components/useUndoRedo.ts Removed unused undo/redo hook implementation.
src/editors/editorsContainer/TemplateModel.tsx Removed hook usage; use editorModelCto + store setters directly.
src/editors/editorsContainer/TemplateMarkdown.tsx Removed hook usage; use editorValue + store setters directly.
src/editors/editorsContainer/AgreementData.tsx Removed hook usage; use editorAgreementData + store setters directly.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

refactor: Cleanup unused useUndoRedo hook and missing UI buttons

2 participants