Skip to content

Fix browse-by pages sending unnecessary request to author index#5382

Open
oscar-escire wants to merge 1 commit intoDSpace:mainfrom
oscar-escire:Issue/3572
Open

Fix browse-by pages sending unnecessary request to author index#5382
oscar-escire wants to merge 1 commit intoDSpace:mainfrom
oscar-escire:Issue/3572

Conversation

@oscar-escire
Copy link
Copy Markdown
Contributor

References

Description

Removes hardcoded default initialization to 'author' browse index that caused unnecessary failed requests when visiting browse-by pages on systems where the 'author' index is disabled.

Before this PR:

  • BrowseByMetadataComponent initialized with a hardcoded request to 'author' browse index
  • When visiting any browse-by page (title, date, subject, etc.), two requests were made:
    1. First to /api/discover/browses/author/entries (unnecessary and would fail if disabled)
    2. Then to the correct browse index (e.g., /api/discover/browses/title/entries)

After this PR:

  • Components wait for route parameters to be available
  • Only one request is made to the correct browse index
  • browseEntries$ remains undefined until properly initialized
  • Loading indicator displays while parameters are being resolved

Instructions for Reviewers

  1. Start the application: npm start:dev
  2. Open browser DevTools (F12) → Network tab
  3. Filter by XHR/Fetch requests
  4. Visit different browse-by pages:

Expected behavior:

  • Only ONE request should be made to the correct browse index
  • NO request should be made to /api/discover/browses/author/entries
  • Loading indicator should display briefly while route parameters are resolved
  • Page should load successfully without errors

List of changes in this PR:

  • Removed hardcoded 'author' default from BrowseByMetadataComponent - the component now waits for route parameters before initializing browse requests
  • Updated BrowseByDateComponent.ngOnInit() to properly use browse ID from route parameters instead of relying on parent's default
  • Updated BrowseByTitleComponent.ngOnInit() to properly use browse ID from route parameters instead of relying on parent's default
  • Fixed BrowseByDateComponent test spy to expect 'dateissued' instead of 'author'
  • Improved loading state handling - loading$ properly initialized to show loading indicator while waiting for route parameters

Checklist

  • 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.

@lgeggleston lgeggleston added bug component: Discovery related to discovery search or browse system 1 APPROVAL pull request only requires a single approval to merge labels Apr 2, 2026
@lgeggleston lgeggleston moved this to 🙋 Needs Reviewers Assigned in DSpace 10.0 Release Apr 2, 2026
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

Projects

Status: 🙋 Needs Reviewers Assigned

Development

Successfully merging this pull request may close these issues.

Browse-by pages produce failing request when REST doesn't support "author" browse

2 participants