fix(alerts): ensure hiding works correctly and alerts are not re-added [DHIS2-15438] - #859
Merged
HendrikThePendric merged 4 commits intoJul 5, 2024
Conversation
HendrikThePendric
requested review from
Birkbjo,
KaiVandivier and
jenniferarnesen
July 4, 2024 14:29
HendrikThePendric
marked this pull request as ready for review
July 4, 2024 15:10
KaiVandivier
approved these changes
Jul 4, 2024
KaiVandivier
left a comment
Contributor
There was a problem hiding this comment.
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>
HendrikThePendric
deleted the
fix/correctly-remove-multiple-alerts-hiding-simultaniously-DHIS2-15438
branch
July 5, 2024 10:06
dhis2-bot
added a commit
that referenced
this pull request
Jul 5, 2024
## [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))
Contributor
|
🎉 This PR is included in version 11.6.1 🎉 The release is available on:
Your semantic-release bot 📦🚀 |
dhis2-bot
added a commit
that referenced
this pull request
Jul 8, 2024
# [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))
Contributor
|
🎉 This PR is included in version 12.0.0-alpha.3 🎉 The release is available on:
Your semantic-release bot 📦🚀 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
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:
alertStackAlertswas 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.