fix: 修改notification 在for 循环下调用api 时,打开通知动画生硬问题 #47688
Open
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.
[中文版模板 / Chinese template]
🤔 This is a ...
🔗 Related issue link
fix: #47086
💡 Background and solution
for 循环调用api 时,会先进队列,但实际上队列中只有一个任务,即每次任务队列都是只有一个任务。看上面的例子,在首次加载时,因为要初始化,所以任务队列中有2个任务,当挂载完后,再次点击onClick, 会发现每次都调用各自方法的全流程,但实际上应该是先进队列,然后再依次执行。
目前方案是加一个锁以及一个promise,让for 循环中的任务都先进队列,然后再按顺序执行队列中的任务
📝 Changelog
☑️ Self-Check before Merge