Skip to content

Conversation

@matt-bernhardt
Copy link
Member

@matt-bernhardt matt-bernhardt commented Nov 17, 2025

Currently, the initial DOM rendering checks for the presence of search results before building the links to search tabs - because we don't want to show tabs on the initial interface prior to the user performing a search.

While it makes sense to hide the tabs before the user does a search, this has a consequence that tabs are also not shown if the user's search generates no results - which isn't quite what we want, because it is possible that another tab may actually have results.

Relevant ticket

https://mitlibraries.atlassian.net/browse/use-172

How does this address that need

This updates the conditional used for the tabs, going from "are there results" to "is there a search in the querystring"? This causes the tabs to be rendered in all cases where they are needed.

Side effects

One of the instances of this codebase, GeoData, provides an advanced search form - so searches might be present there without the q parameter being present. This distinction is saved by the fact that GeoData also doesn't provide tabbed results (and relies on a different view partial for its search form in the first place, so it would never get to this check).

While this is okay for now, if the decision is made down the road to implement tabbed results in GeoData, we will need to make this check a bit more robust. I could imagine that our next step would be to define a helper method for "has the user done a search" that would check not only for q but also for the various other URL parameters associated with different types of searches.

This change would also be required if the USE UI project ends up providing any sort of advanced search form, or introducing a condition wherein the user might have done a search while not using the q parameter.

Developer

Accessibility
  • ANDI or WAVE has been run in accordance to our guide.
  • This PR contains no changes to the view layer.
  • New issues flagged by ANDI or WAVE have been resolved.
  • New issues flagged by ANDI or WAVE have been ticketed (link in the Pull Request details above).
  • No new accessibility issues have been flagged.
New ENV
  • All new ENV is documented in README.
  • All new ENV has been added to Heroku Pipeline, Staging and Prod.
  • ENV has not changed.
Approval beyond code review
  • UXWS/stakeholder approval has been confirmed.
  • UXWS/stakeholder review will be completed retroactively.
  • UXWS/stakeholder review is not needed.
Additional context needed to review

E.g., if the PR includes updated dependencies and/or data
migration, or how to confirm the feature is working.

Code Reviewer

Code
  • I have confirmed that the code works as intended.
  • Any CodeClimate issues have been fixed or confirmed as
    added technical debt.
Documentation
  • The commit message is clear and follows our guidelines
    (not just this pull request message).
  • The documentation has been updated or is unnecessary.
  • New dependencies are appropriate or there were no changes.
Testing
  • There are appropriate tests covering any new functionality.
  • No additional test coverage is required.

@coveralls
Copy link

coveralls commented Nov 17, 2025

Pull Request Test Coverage Report for Build 19475376408

Details

  • 0 of 0 changed or added relevant lines in 0 files are covered.
  • No unchanged relevant lines lost coverage.
  • Overall coverage remained the same at 97.992%

Totals Coverage Status
Change from base Build 19441836614: 0.0%
Covered Lines: 927
Relevant Lines: 946

💛 - Coveralls

@mitlib mitlib temporarily deployed to timdex-ui-pi-use-172-no-sek7dz November 17, 2025 21:45 Inactive
** Why are these changes being introduced:

Currently, if the initial DOM rendering is done in a condition where
there are no search results, the UI doesn't not include tabs to change
to a different set of results - which prevents the user from potentially
finding results that were initially excluded.

** Relevant ticket(s):

* https://mitlibraries.atlassian.net/browse/use-172

** How does this address that need:

This updates the conditional to look for the presence of a query term,
rather than the presence of results. This allows us to continue to hide
the tabs on initial rendering, prior to a search being done, but should
mean that the tabs are shown in all conditions after a search.

** Document any side effects to this change:

There shouldn't be - the USE application only has a single search
field, so looking for params[:q] should be sufficient to detect a
search. GeoData uses other fields, but it relies on different partials
and doesn't use tabbed results anyway.

Ultimately I could see a helper method for "is there a search?", which
we get close to with the existing readable_param method, but I don't
want to poke this bear until we have a better sense of what a general
solution should look like.
@mitlib mitlib temporarily deployed to timdex-ui-pi-use-172-no-sek7dz November 18, 2025 17:32 Inactive
@matt-bernhardt matt-bernhardt changed the title Remove conditional when rendering search tabs Update conditional when rendering search tabs Nov 18, 2025
@JPrevost JPrevost self-assigned this Nov 18, 2025
@matt-bernhardt matt-bernhardt merged commit 20ad4d3 into main Nov 18, 2025
5 checks passed
@matt-bernhardt matt-bernhardt deleted the use-172-no-results branch November 18, 2025 19:22
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants