Skip to content

Conversation

@matt-bernhardt
Copy link
Member

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

Our rendering of contributors from TIMDEX apparently has a bug that skips rendering anything if there is only one contributor on the record. This appears to be caused by our use of .uniq in the rendering partial, because there is an optimization with Ruby's handling of .uniq that skips entirely an entity with only one element (because all it's doing is trying to define unique elements, and a list of one element is by definition unique).

Adding an .each call to this construct forces the iteration to take place, separating the filtering step from the iterator.

Relevant ticket

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

To confirm this behavior

Compare a search for archives on the TIMDEX tab, between the production app and this review app. The 11th result and the 16th result should show a single contributor on the review app, while being blank in production.

Document any side effects to this change

Hopefully none.

Please note:

I've chosen note to update any tests for this fix, but I'm not certain this is the correct choice. This is a view-layer behavior, so we don't normally have tests like this, but not having a test like this caused us to miss this in the first place.

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.

** Why are these changes being introduced:

Our rendering of contributors from TIMDEX apparently has a bug that
skips rendering anything if there is only one contributor on the record.

** Relevant ticket(s):

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

** How does this address that need:

This adds an .each call to the .uniq filter that exists, which forces
Rails to actually process the single resulting record in the case of a
single contributor being present on the record.

** Document any side effects to this change:

Hopefully none.
@coveralls
Copy link

Pull Request Test Coverage Report for Build 19475519218

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-214-bu-tsdwqi November 18, 2025 17:41 Inactive
@JPrevost JPrevost self-assigned this Nov 18, 2025
@matt-bernhardt matt-bernhardt merged commit 7104192 into main Nov 18, 2025
5 checks passed
@matt-bernhardt matt-bernhardt deleted the use-214-bug branch November 18, 2025 19:16
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