Skip to content

Render fulfillment container only when applicable#402

Open
jazairi wants to merge 4 commits into
mainfrom
use-611
Open

Render fulfillment container only when applicable#402
jazairi wants to merge 4 commits into
mainfrom
use-611

Conversation

@jazairi
Copy link
Copy Markdown
Contributor

@jazairi jazairi commented Jun 4, 2026

Why these changes are being introduced:

The fulfillment link container currently renders
as an empty div when no links are available. This
pollutes the DOM and affects spacing.

Relevant ticket(s):

How this addresses that need:

Primo link removal moves further up in the control
flow, because that check is not applicable if the
parent element is gone.

Side effects of this change:

None.

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.

@qltysh
Copy link
Copy Markdown

qltysh Bot commented Jun 4, 2026

1 new issue

Tool Category Rule Count
qlty Structure Function with high complexity (count = 9): load 1

@coveralls
Copy link
Copy Markdown

coveralls commented Jun 4, 2026

Coverage Report for CI Build 26986953058

Coverage remained the same at 98.319%

Details

  • Coverage remained the same as the base build.
  • Patch coverage: No coverable lines changed in this PR.
  • No coverage regressions found.

Uncovered Changes

No uncovered changes found.

Coverage Regressions

No coverage regressions found.


Coverage Stats

Coverage Status
Relevant Lines: 1428
Covered Lines: 1404
Line Coverage: 98.32%
Coverage Strength: 75.09 hits per line

💛 - Coveralls

@mitlib mitlib temporarily deployed to timdex-ui-pi-use-611-oftuzrder June 4, 2026 16:29 Inactive
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This PR updates the Stimulus content-loader controller to avoid leaving empty fulfillment/link containers in the DOM when the fetched HTML response contains no meaningful content, reducing DOM pollution and preventing unintended spacing/layout artifacts in results.

Changes:

  • If the fetched HTML is empty/whitespace-only, remove the loader element instead of replacing it with empty output.
  • Preserve existing behavior that removes .primo-link elements when a .libkey-link is present.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread app/javascript/controllers/content_loader_controller.js Outdated
@jazairi jazairi temporarily deployed to timdex-ui-pi-use-611-oftuzrder June 4, 2026 16:34 Inactive
@jazairi jazairi requested a review from Copilot June 4, 2026 16:34
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 1 out of 1 changed files in this pull request and generated no new comments.

@jazairi jazairi temporarily deployed to timdex-ui-pi-use-611-oftuzrder June 4, 2026 17:40 Inactive
Why these changes are being introduced:

The fulfillment link container currently renders
as an empty div when no links are available. This
pollutes the DOM and affects spacing.

Relevant ticket(s):

- [USE-611](https://mitlibraries.atlassian.net/browse/USE-611)

How this addresses that need:

This removes the parent div if no fulfillment links
are present.

Side effects of this change:

Primo link removal moves further up in the control
flow, because that check is not applicable if the
parent element is gone.
Comment thread app/javascript/controllers/content_loader_controller.js Fixed
// Remove result-get container (no fulfillment links)
parentElement.remove();
}
})
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Function with high complexity (count = 7): load [qlty:function-complexity]

@jazairi jazairi temporarily deployed to timdex-ui-pi-use-611-oftuzrder June 4, 2026 17:41 Inactive
@jazairi jazairi temporarily deployed to timdex-ui-pi-use-611-oftuzrder June 4, 2026 17:50 Inactive
@jazairi jazairi requested a review from Copilot June 4, 2026 19:02
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 1 out of 1 changed files in this pull request and generated 2 comments.

Comment thread app/javascript/controllers/content_loader_controller.js
Comment thread app/javascript/controllers/content_loader_controller.js Outdated
@jazairi jazairi temporarily deployed to timdex-ui-pi-use-611-oftuzrder June 4, 2026 19:51 Inactive
@jazairi jazairi requested a review from Copilot June 4, 2026 19:51
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 1 out of 1 changed files in this pull request and generated 2 comments.

Comment thread app/javascript/controllers/content_loader_controller.js
Comment on lines +10 to +20
stripHtmlComments(input) {
let previous
let output = input

do {
previous = output
output = output.replace(/<!--[\s\S]*?-->/g, '')
} while (output !== previous)

return output
}
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

The change Copilot is suggesting is what I originally had. It would override the existing code in this helper method, which was suggested in a prior Copilot review. 🙃

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