Fix #5336: General system alert visible to users in real time without…#5451
Fix #5336: General system alert visible to users in real time without…#5451guillermo-escire wants to merge 3 commits intoDSpace:mainfrom
Conversation
…ithout reloading the page.
| })); | ||
| this.subscriptions.push( | ||
| this.router.events.pipe( | ||
| filter(event => event instanceof NavigationEnd), |
There was a problem hiding this comment.
This is going to spam that endpoint a lot, instead I would only trigger it every certain amount of minutes. We could make this interval configurable as well similar to the auth.ui.timeUntilIdle configuration
There was a problem hiding this comment.
Hi @alexandrevryghem, thanks for the feedback! I've addressed this by adding a throttleTime operator to limit how often the endpoint is called during navigation. The interval is now configurable via appConfig.systemWideAlert.refreshIntervalMs, similar to auth.ui.timeUntilIdle, with a default of 5 minutes.
|
Hi @alexandrevryghem, the failing test (SubmissionService - redirectToEditItem) is not related to this pull request. It's failing due to a pre-existing issue in submission.service.spec.ts where findById is being parsed twice. It's failing regardless of any changes made to this pull request. I'm going to run the tests again. |
References
Description
Fixes an issue where system-wide alerts were not updated in real time for users already browsing the site. The alert banner now refreshes on navigation and properly handles deactivation without requiring a manual page reload.
Instructions for Reviewers
This PR ensures that system-wide alerts are dynamically updated during normal navigation without requiring a full page reload.
Changes
List of changes in this PR:
NavigationEndrouter eventstartWith(null)to trigger initial fetch on component loadsearchByto ensure fresh data is retrievednullHow to test
Open DSpace in two browser sessions (or one normal + one incognito)
In Browser 1:
In Browser 2 (admin user):
In Browser 1:
Still in Browser 2:
In Browser 1:
Checklist
This checklist provides a reminder of what we are going to look for when reviewing your PR. You do not need to complete this checklist prior creating your PR (draft PRs are always welcome).
However, reviewers may request that you complete any actions in this list if you have not done so. If you are unsure about an item in the checklist, don't hesitate to ask. We're here to help!
mainbranch of code (unless it is a backport or is fixing an issue specific to an older branch).npm run lintnpm run check-circ-deps)package.json), I've made sure their licenses align with the DSpace BSD License based on the Licensing of Contributions documentation.