Skip to content

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

Merged
tdonohue merged 1 commit into
DSpace:mainfrom
oscar-escire:Issue/3572
May 20, 2026
Merged

Fix browse-by pages sending unnecessary request to author index#5382
tdonohue merged 1 commit into
DSpace:mainfrom
oscar-escire:Issue/3572

Conversation

@oscar-escire
Copy link
Copy Markdown
Contributor

@oscar-escire oscar-escire commented Apr 1, 2026

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
Copy link
Copy Markdown

@nathanmlf nathanmlf left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hey @oscar-escire! Tested it on my side and everything seems to be working as expected. Great job!

@tdonohue tdonohue moved this from 🙋 Needs Reviewers Assigned to 👍 Reviewer Approved in DSpace 10.0 Release May 18, 2026
@tdonohue tdonohue added 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 port to dspace-9_x This PR needs to be ported to `dspace-9_x` branch for next bug-fix release labels May 20, 2026
Copy link
Copy Markdown
Member

@tdonohue tdonohue left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍 Thanks @oscar-escire ! This looks good to me and works based on my testing.

I think this impacts all recent major releases, so I'm flagging this for automatic backport. At a minimum, it'd be good to backport to 9.x if possible.

@tdonohue tdonohue added this to the 10.0 milestone May 20, 2026
@tdonohue tdonohue merged commit f5e8730 into DSpace:main May 20, 2026
16 checks passed
@github-project-automation github-project-automation Bot moved this from 👍 Reviewer Approved to ✅ Done in DSpace 10.0 Release May 20, 2026
@dspace-bot
Copy link
Copy Markdown
Contributor

Backport failed for dspace-7_x, because it was unable to cherry-pick the commit(s).

Please cherry-pick the changes locally and resolve any conflicts.

git fetch origin dspace-7_x
git worktree add -d .worktree/backport-5382-to-dspace-7_x origin/dspace-7_x
cd .worktree/backport-5382-to-dspace-7_x
git switch --create backport-5382-to-dspace-7_x
git cherry-pick -x 11ed6485a898815f97755f2ec05ab39b16338559

@dspace-bot
Copy link
Copy Markdown
Contributor

Backport failed for dspace-8_x, because it was unable to cherry-pick the commit(s).

Please cherry-pick the changes locally and resolve any conflicts.

git fetch origin dspace-8_x
git worktree add -d .worktree/backport-5382-to-dspace-8_x origin/dspace-8_x
cd .worktree/backport-5382-to-dspace-8_x
git switch --create backport-5382-to-dspace-8_x
git cherry-pick -x 11ed6485a898815f97755f2ec05ab39b16338559

@dspace-bot
Copy link
Copy Markdown
Contributor

Backport failed for dspace-9_x, because it was unable to cherry-pick the commit(s).

Please cherry-pick the changes locally and resolve any conflicts.

git fetch origin dspace-9_x
git worktree add -d .worktree/backport-5382-to-dspace-9_x origin/dspace-9_x
cd .worktree/backport-5382-to-dspace-9_x
git switch --create backport-5382-to-dspace-9_x
git cherry-pick -x 11ed6485a898815f97755f2ec05ab39b16338559

@tdonohue
Copy link
Copy Markdown
Member

@oscar-escire : Unfortunately, this was unable to be auto-backported. If you are interested in seeing this also in 9.x, 8.x or 7.6.x, please create a backport PR against one (or more) of those branches. Otherwise, this fix will only be available in 10.0

@oscar-escire
Copy link
Copy Markdown
Contributor Author

@tdonohue: Sure, as soon as I have the PRs ready for each version, I'll send them over

@lgeggleston lgeggleston removed 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 port to dspace-9_x This PR needs to be ported to `dspace-9_x` branch for next bug-fix release labels May 22, 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: ✅ Done

Development

Successfully merging this pull request may close these issues.

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

5 participants