Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: Enhance useUndoRedo hook with limit and ref optimization #314

Open
wants to merge 4 commits into
base: main
Choose a base branch
from

Conversation

codeAntu
Copy link
Contributor

@codeAntu codeAntu commented Mar 21, 2025

Closes #312

Changes

  • Used useRef for past and future states to avoid unnecessary re-renders.
  • Added a limit parameter to restrict the maximum number of states stored in the undo stack.
  • Used useCallback to memoize the setValue, undo, and redo functions, preventing unnecessary re-renders.
  • Added debounce functionality to the setValue function for improved performance.

Related Issues

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

@codeAntu codeAntu requested a review from a team as a code owner March 21, 2025 16:19
Copy link

netlify bot commented Mar 21, 2025

Deploy Preview for ap-template-playground ready!

Name Link
🔨 Latest commit ad244ca
🔍 Latest deploy log https://app.netlify.com/sites/ap-template-playground/deploys/67e394e4f07d5a0008889ae8
😎 Deploy Preview https://deploy-preview-314--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 site configuration.

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.

Improve useUndoRedo Hook for Better Performance and Maintainability
1 participant