-
Notifications
You must be signed in to change notification settings - Fork 439
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
Get rid of unnecessary and failing REST requests when navigating between different browse indexes #3753
Conversation
Thanks, @jensvannerum. I tested this by navigating to the Browse By Date on sandbox.dspace.org with the network panel open, then switching to Browse by Author. Before, I see HTTP 500 errors: After, I see only HTTP 200: I see some changes to the menu resolver regarding authentication. Was that intentional? Also, I think we should squash these changes to avoid the unnecessary modifications and fixes to packages. Those don't need to live in git forever. |
@jensvannerum : This PR appears to have failing tests. Could you look into it when you have a chance? Thanks! |
9092ba0
to
bc0cd4a
Compare
bc0cd4a
to
a105bcd
Compare
@tdonohue I fixed specs and squashed all commits in to one against the latest main branch for a cleaner git history |
Yes these were intentional since these also sent a bunch of requests to check if we're authenticated here for example: this.authorizationService.isAuthorized(FeatureID.IsCollectionAdmin),
this.authorizationService.isAuthorized(FeatureID.IsCommunityAdmin),
this.authorizationService.isAuthorized(FeatureID.AdministratorOf),
this.authorizationService.isAuthorized(FeatureID.CanSubmit),
this.authorizationService.isAuthorized(FeatureID.CanEditItem),
this.authorizationService.isAuthorized(FeatureID.CanSeeQA),
this.authorizationService.isAuthorized(FeatureID.CoarNotifyEnabled), Although these are not 100% related to the browse pages specifically, there's no point in sending these requests if we're not authenticated in any way I think. |
Thanks @jensvannerum. This looks good now, all tests passing and with one clean commit. I gave it another test just to be sure, and the HTTP 500 errors are gone when switching between browses, both as an anonymous user and as an admin. |
Backport failed for Please cherry-pick the changes locally and resolve any conflicts. git fetch origin dspace-7_x
git worktree add -d .worktree/backport-3753-to-dspace-7_x origin/dspace-7_x
cd .worktree/backport-3753-to-dspace-7_x
git switch --create backport-3753-to-dspace-7_x
git cherry-pick -x a105bcd6f45d8e85844cd473964670e1461b29cf |
Successfully created backport PR for |
Dear @jensvannerum, the automatic backport to |
7.x backport in #3788 |
References
Description
ngOnInit
in the browse-by component, this way we can be sure that we only care about the first value of the route (necessary for ourtake(1)
in subscription)browse-by-page-component
the type is wrapped in an object so a change from one browse index to another browse index of the same type still causes a lifecycle trigger (since objects are compared by identity).You could argue that performance wise we don't want to re-build the component every time but any performance gains that this would offer is lost by the multiple useless requests I think
Instructions for Reviewers
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!
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.