-
Notifications
You must be signed in to change notification settings - Fork 16
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
fix(alerts): ensure hiding works correctly and alerts are not re-added [DHIS2-15438] #859
fix(alerts): ensure hiding works correctly and alerts are not re-added [DHIS2-15438] #859
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good -- interesting problem and solution! Thanks for the tests too 🙏 I also reproduced and tested it out in the example app:
Before -
alerts-before.mov
After -
alerts-after.mov
Co-authored-by: Kai Vandivier <49666798+KaiVandivier@users.noreply.github.com>
## [11.6.1](v11.6.0...v11.6.1) (2024-07-05) ### Bug Fixes * **alerts:** ensure hiding works correctly and alerts are not re-added [DHIS2-15438] ([#859](#859)) ([6b11fff](6b11fff))
🎉 This PR is included in version 11.6.1 🎉 The release is available on:
Your semantic-release bot 📦🚀 |
# [12.0.0-alpha.3](v12.0.0-alpha.2...v12.0.0-alpha.3) (2024-07-08) ### Bug Fixes * **alerts:** ensure hiding works correctly and alerts are not re-added [DHIS2-15438] ([#859](#859)) ([6b11fff](6b11fff)) * fixed dimensions plugins [LIBS-634] ([#858](#858)) ([1f717f3](1f717f3)) * small text change in changelog ([824dd2f](824dd2f)) ### Features * cleanup plugin error boundary [UX-136] ([#856](#856)) ([de252fe](de252fe)) * parse additional namespaces from `d2.config.js` and add to `manifest.webapp` [LIBS-638] ([#860](#860)) ([62782fe](62782fe))
🎉 This PR is included in version 12.0.0-alpha.3 🎉 The release is available on:
Your semantic-release bot 📦🚀 |
This PR fixes a bug that was observed in the maps-app where multiple info alerts were added at approximately the same time. These alerts would then also hide at approximately the same time, but one alert would finish first and this would cause the other one to remount and restart its appear/show/hide lifecycle.
It took a long time to debug this issue and I found a few things wrong:
alertStackAlerts
was an empty array when it should have been populated. In the next render cycle, the array would have the expected alerts again, but because the array was empty during the previous render cycle, everything was remounting all the time.After fixing that empty-array and double render problem I realised I had broken some preexisting functionality: As I explain here, there is a fundamental difference between how alerts hide "naturally" VS programatically. I had already catered for this in the original implementation, but broke that while fixing the initial bug. I found this problem by chance: there were no test cases that broke. So I decided to add a test for this as well.