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

perf(noti): avoid unnecessary loop execution #45

Merged
merged 2 commits into from Dec 7, 2023

Conversation

Mini-ghost
Copy link
Contributor

πŸ”— Linked issue

N/A

❓ Type of change

  • πŸ“– Documentation (updates to the documentation or readme)
  • 🐞 Bug fix (a non-breaking change that fixes an issue)
  • πŸ‘Œ Enhancement (improving an existing functionality like performance)
  • ✨ New feature (a non-breaking change that adds functionality)
  • ⚠️ Breaking change (fix or feature that would cause existing functionality to change)

πŸ“š Description

Currently, we will push noti into belongGroup, and will get noti from belongGroup again, because, we need

https://github.com/Rock070/vue3-noti/blob/9b8774bec89cd4772a5235cdd14c206817b43a2b/packages/core/src/composables/useCreateNoti.ts#L105-L107C5

Now, we push noti into belongGroup and get noti from belongGroup again, because we need to turn noti into responsive data through this operation.

The way we get out noti again is to use Array.prototype.find, but we have other ways to avoid the execution of the loop

  1. Directly convert noti into responsive data
  2. Use a more direct method to get noti from belongGroup

The first method may be more intuitive, but will change the return value of the notify function, so this PR uses the second method.

πŸ“ Checklist

  • I have read the Contributing Guidelines.
  • I have linked an issue or discussion.
  • I have updated the documentation accordingly.

Copy link

vercel bot commented Dec 7, 2023

The latest updates on your projects. Learn more about Vercel for Git β†—οΈŽ

Name Status Preview Comments Updated (UTC)
vue3-noti βœ… Ready (Inspect) Visit Preview πŸ’¬ Add feedback Dec 7, 2023 4:36pm

@Rock070 Rock070 merged commit aa2bf27 into Rock070:main Dec 7, 2023
8 checks passed
@Mini-ghost Mini-ghost deleted the perf/reduce-loop-execution branch December 8, 2023 00:03
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.

None yet

2 participants