-
Notifications
You must be signed in to change notification settings - Fork 437
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 infinite loading on item pages and optimize menu resolver usage #3677
Fix infinite loading on item pages and optimize menu resolver usage #3677
Conversation
…st and the ResponsePending are not emitted
… item bitstream & relationship tabs
…nuResolver on pages who use the DsoEditMenuComponent
910459d
to
5c9f494
Compare
This is missing a |
@alanorth: The |
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.
The changes look great. Thanks @alexandrevryghem !
I have had a practical test in my local environment and cannot reproduce the reported problem.
I was hoping the base data service changes might also fix the same "infinite load state" issues in the My DSpace page as well, but no such luck... are there some component-level improvements that we can reuse or apply to My DSpace?
@kshepherd: Thnx for the review! I haven't noticed any loading issues on the MyDSpace page, is this also reproducible on the demo servers? I did see however that when you switch between the workflow & workspace tabs that some facet requests are failing but this doesn't seem to cause any infinite loading issues. I also took a quick looked at the components and saw that one observable call could be removed (8849f14), I'll contribute this later but I would need more details on where/when it happens in order to debug this |
@alexandrevryghem we got some reports from user that my dspace has infinite load times after publishing new items. I was just able to reproduce it on demo by importing and submitting multiple entries and then playing around with the search filters. |
@pnbecker & @kshepherd: If it’s also occurring on the demo, I would suggest moving this to a separate issue. Could one of you please open a new ticket with steps to reproduce it, and perhaps include a small video? |
I have no clear way to reproduce it yet. I opened ticket #3697 anyway to gather information if other users run into this too. |
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.
👍 Thanks @alexandrevryghem ! I gave this a test today and a code review. Code looks good, and I cannot reproduce the bug locally with this PR in place. Merging as this is at +2
Successfully created backport PR for |
@alexandrevryghem : This was ported to 8.x automatically. If there are parts that you feel would be worth porting to 7.x (as you previously mentioned), then I'd gladly review/test them quickly. As a sidenote, the |
References
Description
Fixed the issue where switching between item pages could cause an infinite loading screen. This issue was caused by requests made in
dsoEditMenuResolver
that set theuseCachedVersionIfAvailable
tofalse
. The problem arose due to a change in the timing of when a request is actually sent to the backend. Since Angular 16, anasapScheduler
causes requests to sometimes happen sooner. This broke this logic, which prevents cached data (when the cache is disabled) and stale data from being returned immediately when the service call is made.The bitstream and relationship pages also had an additional issue that could cause an infinite loading screen. When navigating to these pages, you could sometimes see the error
no elements in sequence
in the console. This occurred when taking the first value of an observable that does not emit. This issue has been fixed.Finally, the menu resolver was being resolved in too many places. It should only be resolved on pages that use the
DsoEditMenuComponent
. Therefore, it has been restricted to resolve only for the simple item page, the full item page, and the community and collection pages. All other places, such as the edit item/collection/community tabs and the browse tab, no longer need to resolve it. As a result, the edit item metadata tab, for example, now requires five fewer requests.Instructions for Reviewers
List of changes in this PR:
Fixed the edge case where sending a request with
useCachedVersionIfAvailable === false
could cause an infinite loading screen:Previously, when a cached version was already present in the store, the
RemoteDataBuildService#buildList
would always first emit the cached value. This was then followed by aResponsePending
, which in turn was followed by the new response.Because we don't want to return the old cached value when
useCachedVersionIfAvailable
isfalse
, askipWhile
was added to filter out all completed responses until a non-completed response was emitted.Due to recent changes, requests are sent earlier, which can cause the
RemoteDataBuildService#buildList
to already have the new completed response ready. The issue is that theskipWhile
mistakenly interprets this as the old cached value (because no non-completed response was emitted), causing the observable to never emit.The fix is to update the
skipWhile
logic to not rely on theRemoteData
'sstate
to skip responses. Instead, it should compare thelastUpdated
timestamp with the time before the request was sent. This ensures that all responses emitted by theRemoteDataBuildService#buildList
are skipped unless they are new.Fixed the
no elements in sequence
issue for theItemBitstreamsComponent
andItemRelationshipsComponent
. This was resolved by replacing thefirst()
operators withtake(1)
to prevent such an error from being thrown.Removed the
dsoEditMenuResolver
from the browse routes since the browse pages were separated from the community and collection pages in Refactored community & collection pages #2722, making the menu no longer necessary.Moved the
dsoEditMenuResolver
to resolve only for simple/full item pages rather than for every item, collection, or community route. This prevents routes like edit metadata from resolving the menu.Updated the correction types call in
DSOEditMenuResolverService
to always use the cache when such a request is present. However, if this was done to ensure it is re-fetched in certain situations, we should refactor it to mark the data as stale instead.Guidance for how to test or review this PR:
Checklist
main
branch of code (unless it is a backport or is fixing an issue specific to an older branch).npm run lint
npm 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.