iTwin / appui

Monorepo for iTwin.js AppUi
MIT License
9 stars 2 forks source link

Fix `MessageManager.addMessage` to only add unique messages #1042

Closed GerardasB closed 2 months ago

GerardasB commented 2 months ago

Changes

This PR fixes MessageManager.addMessage() to ignore already active messages displayed to the user (for all message types, like Toast or Sticky). This API is used by various tools indirectly via IModelApp.notifications.outputMessage when AppNotificationManager is set up. This change should prevent the same message from being displayed multiple times unnecessarily.

Ideally, tools and other consumers should throttle the messages manually i.e. in mouse wheel scroll handlers. In the future, an option argument can be added if there is a use case where multiple equal messages need to be added.

Testing

Additional unit tests were added and tested via the test app.

GerardasB commented 1 week ago

@Mergifyio backport release/4.17.x

mergify[bot] commented 1 week ago

backport release/4.17.x

✅ Backports have been created

* [#1124 Fix `MessageManager.addMessage` to only add unique messages (backport #1042)](https://github.com/iTwin/appui/pull/1124) has been created for branch `release/4.17.x` but encountered conflicts