Skip to content
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

Open
wants to merge 7 commits into
base: main
Choose a base branch
from

Conversation

jensvannerum
Copy link
Contributor

References

Description

  • Destroys and reconstructs the browse component when the route changes so that any route change calls 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 our take(1) in subscription)
    • in the browse-by-page-componentthe 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

  • Set this angular branch up against latest main / demo instance
  • Open any browse index and switch to other browse indexes while having the 'Network' tab open in developer tools
  • Notice no unnecessary requests are being sent and no failing requests are present either (compare to eg current demo.dspace.org)
  • Verify browse indexes still work as before including pagination, filtering, ordering thumbnails, etc...

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!

  • My PR is created against the main branch of code (unless it is a backport or is fixing an issue specific to an older branch).
  • My PR is small in size (e.g. less than 1,000 lines of code, not including comments & specs/tests), or I have provided reasons as to why that's not possible.
  • My PR passes ESLint validation using npm run lint
  • My PR doesn't introduce circular dependencies (verified via npm run check-circ-deps)
  • My PR includes TypeDoc comments for all new (or modified) public methods and classes. It also includes TypeDoc for large or complex private methods.
  • My PR passes all specs/tests and includes new/updated specs or tests based on the Code Testing Guide.
  • My PR aligns with Accessibility guidelines if it makes changes to the user interface.
  • My PR uses i18n (internationalization) keys instead of hardcoded English text, to allow for translations.
  • My PR includes details on how to test it. I've provided clear instructions to reviewers on how to successfully test this fix or feature.
  • If my PR includes new libraries/dependencies (in package.json), I've made sure their licenses align with the DSpace BSD License based on the Licensing of Contributions documentation.
  • If my PR includes new features or configurations, I've provided basic technical documentation in the PR itself.
  • If my PR fixes an issue ticket, I've linked them together.

@jensvannerum jensvannerum marked this pull request as draft December 16, 2024 14:25
@jensvannerum jensvannerum marked this pull request as ready for review December 16, 2024 16:01
@tdonohue tdonohue added bug component: Discovery related to discovery search or browse system high priority 1 APPROVAL pull request only requires a single approval to merge port to dspace-7_x This PR needs to be ported to `dspace-7_x` branch for next bug-fix release port to dspace-8_x This PR needs to be ported to `dspace-8_x` branch for next bug-fix release labels Dec 16, 2024
@alanorth
Copy link
Contributor

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:

2024-12-17T15:41:55,857862487+03:00-fs8

After, I see only HTTP 200:

2024-12-17T15:43:13,821823700+03:00-fs8

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.

@tdonohue
Copy link
Member

@jensvannerum : This PR appears to have failing tests. Could you look into it when you have a chance? Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
1 APPROVAL pull request only requires a single approval to merge bug component: Discovery related to discovery search or browse system high priority port to dspace-7_x This PR needs to be ported to `dspace-7_x` branch for next bug-fix release port to dspace-8_x This PR needs to be ported to `dspace-8_x` branch for next bug-fix release
Projects
Status: 👍 Reviewer Approved
Development

Successfully merging this pull request may close these issues.

Hitting browse by author from by issue date gets server error
4 participants