Conversation
Co-Authored-By: Symin <syminomega@outlook.com>
Reviewer's GuideEnhanced the Toast component’s JavaScript by conditionally hiding toasts only when autohide is disabled and removing an unnecessary reconfiguration of the autohide setting during updates. File-Level Changes
Assessment against linked issues
Possibly linked issues
Tips and commandsInteracting with Sourcery
Customizing Your ExperienceAccess your dashboard to:
Getting Help
|
There was a problem hiding this comment.
Hey @ArgoZhang - I've reviewed your changes - here's some feedback:
- The
transitionendhandler now only hides toasts whenautohideis false, which inverts the expected behavior and will prevent automatic dismissal whenautohideis true. - The
updatefunction no longer synchronizes theautohidesetting intotoast._config, leading to mismatches between the DOM attributes and the toast’s internal state. - Accessing the private
_configproperty may be fragile—consider using or extending the public API for updating toast configuration instead of touching internal fields directly.
Here's what I looked at during the review
- 🟡 General issues: 2 issues found
- 🟢 Testing: all looks good
- 🟢 Complexity: all looks good
- 🟢 Documentation: all looks good
Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.
| }) | ||
| EventHandler.on(progressElement, 'transitionend', e => { | ||
| toast.toast.hide(); | ||
| if (toast.toast._config.autohide === false) { |
There was a problem hiding this comment.
issue (bug_risk): Reverse autohide logic: only hide on manual dismiss
Invert the condition so toast.hide() runs when _config.autohide is true instead of false.
| @@ -42,8 +44,6 @@ export function update(id) { | |||
| const autoHide = element.getAttribute('data-bs-autohide') !== 'false'; | |||
| if (autoHide) { | |||
| const delay = parseInt(element.getAttribute('data-bs-delay')); | |||
There was a problem hiding this comment.
suggestion (bug_risk): Restore updating autohide in update method
Without that assignment, changes to data-bs-autohide won’t update the toast instance, causing stale behavior. Re-add it or otherwise sync autohide on update.
| const delay = parseInt(element.getAttribute('data-bs-delay')); | |
| const autoHide = element.getAttribute('data-bs-autohide') !== 'false'; | |
| toast._config.autohide = autoHide; |
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## main #6042 +/- ##
=========================================
Coverage 100.00% 100.00%
=========================================
Files 701 701
Lines 30958 30958
Branches 4378 4378
=========================================
Hits 30958 30958 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
Link issues
fixes #6038 #6034 #6036
Summary By Copilot
Regression?
Risk
Verification
Packaging changes reviewed?
☑️ Self Check before Merge
Summary by Sourcery
Refactor toast JavaScript logic to correct autohide behavior and remove redundant configuration updates
Bug Fixes:
Enhancements: