Skip to content

Conversation

@jensvannerum
Copy link
Contributor

References

Description

Introduces a new service method to obtain the configured sort direction of a browse index which is then used in the relevant browse components to do the initial fetch. Manually changing sort direction on page will override the configuration of course.

Instructions for Reviewers

In your dspace.cfg change some of the default browse indexes by adding a custom sort order to them ("adding :desc at the end as they currently default to asc)

  • Verify the browse index loads with this sort order applied
  • Verify manually changing pagination / sort order still works as intended
  • Verify all other browse functionality still works as intended

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.

@tdonohue tdonohue added bug component: Discovery related to discovery search or browse system 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 12, 2024
@github-actions
Copy link

Hi @jensvannerum,
Conflicts have been detected against the base branch.
Please resolve these conflicts as soon as you can. Thanks!

@kanasznagyzoltan
Copy link
Contributor

Set the title as desc in dspace.cfg when browse is opened it is ordered correctly in a a descending order. The other browses seem to be working fine too.

DSpace.Repository.__.Community.List_converted.mp4

@tdonohue tdonohue moved this to 🙋 Needs Reviewers Assigned in DSpace 10.0 Release May 19, 2025
@kanasznagyzoltan
Copy link
Contributor

Dear @jensvannerum
At the time of the testing we have found it is working. Could you resolve the conflicts?
Thank you!

@nwoodward
Copy link
Contributor

Hi @jensvannerum. This PR looks good, and I'd like to review it. Could you resolve the merge conflicts?

@jensvannerum jensvannerum force-pushed the w2p-122064_browse-pages-ignore-sort-config-fix-UI-main branch from 3ccfabc to 789c614 Compare September 19, 2025 14:06
Copy link
Contributor

@nwoodward nwoodward left a comment

Choose a reason for hiding this comment

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

👍 Thanks @jensvannerum. With this PR I am able to change the sort direction of the browse indices and see it reflected in the pagination options.

@github-project-automation github-project-automation bot moved this from 🙋 Needs Reviewers Assigned to 👍 Reviewer Approved in DSpace 10.0 Release Sep 19, 2025
@tdonohue tdonohue added the port to dspace-9_x This PR needs to be ported to `dspace-9_x` branch for next bug-fix release label Oct 1, 2025
Copy link
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.

@jensvannerum : I gave this a quick test today to try to move it along (as it's at +1). While this code works, when I watch the requests sent to the backend (REST API) I'm now seeing two requests.

For example, I've set this in my dspace.cfg:

webui.browse.index.1 = dateissued:item:dateissued:desc

Now, if I open up my DevTools and go to "Browse by Issue Date", I'll see two requests sent to the REST API:

GET /api/discover/browses/dateissued/items?page=0&size=1&sort=default,ASC
GET /api/discover/browses/dateissued/items?page=0&size=1&sort=default,DESC

Notice how the first request is still wrong. It's sending an ASC request when I've configured it for DESC. But, it's immediately followed by a DESC request which ultimately returns the correct search (and this is what is displayed in the User Interface).

Would it be possible to get rid of the first request here? Overall, this code works, but it seems wasteful to send two requests when we need just one.

@github-project-automation github-project-automation bot moved this from 👍 Reviewer Approved to 👀 Under Review in DSpace 10.0 Release Oct 1, 2025
@github-actions
Copy link

Hi @jensvannerum,
Conflicts have been detected against the base branch.
Please resolve these conflicts as soon as you can. Thanks!

@tdonohue
Copy link
Member

@jensvannerum : Any chance that you'll find time to get back to this PR at some point to solve the outstanding feedback? There are new comments also on the issue ticket #8651 asking for a status update as well.

If you are unable to move this forward, we could also search out a new volunteer. Thanks!

@jensvannerum
Copy link
Contributor Author

jensvannerum commented Jan 23, 2026

Hi @tdonohue, I had considered this PR finished so I missed this feedback, sorry about that.

I think the PR does fix the linked issue, the extra you call mention seeing is expected, it's from the data picker component getting the first (asc) and last (desc) date to show the correct ranges of dates, you'll see this doesn't happen on other (non date) browse indices.

The same behavior is also visible on the demo instance

@jensvannerum jensvannerum force-pushed the w2p-122064_browse-pages-ignore-sort-config-fix-UI-main branch from 232f184 to a9a9e97 Compare January 23, 2026 09:50
@tdonohue tdonohue self-requested a review January 23, 2026 15:16
@tdonohue tdonohue moved this from 👀 Under Review to 👍 Reviewer Approved in DSpace 10.0 Release Jan 23, 2026
Copy link
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 @jensvannerum for revisiting this and explaining the behavior. On retesting, I see that you're correct and this behavior is the same as current. I can verify this PR fixes the bug as described. Looks good to me!

@tdonohue tdonohue merged commit 5f027e1 into DSpace:main Jan 26, 2026
18 of 19 checks passed
@github-project-automation github-project-automation bot moved this from 👍 Reviewer Approved to ✅ Done in DSpace 10.0 Release Jan 26, 2026
@dspace-bot
Copy link
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-3741-to-dspace-7_x origin/dspace-7_x
cd .worktree/backport-3741-to-dspace-7_x
git switch --create backport-3741-to-dspace-7_x
git cherry-pick -x 86c30e99b6cdefc9df7c9da46ddbad3e17ef0911 2d64c1cd58a5aead6cc880e232b42b7f16639adc 5b0e7c112b96da23fd06bbc4485db3cc9d40b3c0 f779bbe813e092f4c9ebd7a965f0ae410bbf4391 789c614556c23dcca39f6a53e31d5def83c8fe77

@dspace-bot
Copy link
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-3741-to-dspace-8_x origin/dspace-8_x
cd .worktree/backport-3741-to-dspace-8_x
git switch --create backport-3741-to-dspace-8_x
git cherry-pick -x 86c30e99b6cdefc9df7c9da46ddbad3e17ef0911 2d64c1cd58a5aead6cc880e232b42b7f16639adc 5b0e7c112b96da23fd06bbc4485db3cc9d40b3c0 f779bbe813e092f4c9ebd7a965f0ae410bbf4391 789c614556c23dcca39f6a53e31d5def83c8fe77

@tdonohue tdonohue added this to the 10.0 milestone Jan 26, 2026
@dspace-bot
Copy link
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-3741-to-dspace-9_x origin/dspace-9_x
cd .worktree/backport-3741-to-dspace-9_x
git switch --create backport-3741-to-dspace-9_x
git cherry-pick -x 86c30e99b6cdefc9df7c9da46ddbad3e17ef0911 2d64c1cd58a5aead6cc880e232b42b7f16639adc 5b0e7c112b96da23fd06bbc4485db3cc9d40b3c0 f779bbe813e092f4c9ebd7a965f0ae410bbf4391 789c614556c23dcca39f6a53e31d5def83c8fe77

@tdonohue
Copy link
Member

@jensvannerum : It looks like all the backports failed here, and I see it's because of changes on main in these files. If you find time to create backports, I'd gladly review/merge them. If not, then we'll just have this fixed in 10.0.

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

Projects

Status: ✅ Done

Development

Successfully merging this pull request may close these issues.

Browse pages don't take into account sort configuration

5 participants