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

refactor: Removed unnecessary code and improved code readability from use-toast #5200

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

TheCoderAdi
Copy link

Refactor Toast Dispatch Logic and ID Handling for Simplification

Description:

This PR simplifies both the toastId and id handling in the dispatch logic by refactoring key-value pairs where both the key and value were the same (toastId: toastId, id: id) to just toastId and id. These changes enhance code readability and remove redundancy without altering functionality.

Changes:

  • Refactored the dispatch actions to use shorthand syntax for toastId and id.
  • Ensured the id generation and handling are consistent with the shorthand pattern.
  • No functional changes to the toast state management or behavior.

Testing:

  • Manually tested the toast system to confirm proper behavior for adding, updating, and dismissing toasts.
  • Verified that state management and toast dismissal remain unaffected.

Motivation:

This refactor improves code clarity, reduces redundancy, and follows best practices, making the codebase cleaner and easier to maintain.

No breaking changes introduced.

Removed unnecessary code and improved code readability.
Copy link

vercel bot commented Oct 4, 2024

@TheCoderAdi is attempting to deploy a commit to the shadcn-pro Team on Vercel.

A member of the Team first needs to authorize it.

@TheCoderAdi
Copy link
Author

Please review this PR.

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.

1 participant