Conversation
1 new issue
|
Coverage Report for CI Build 26986953058Coverage remained the same at 98.319%Details
Uncovered ChangesNo uncovered changes found. Coverage RegressionsNo coverage regressions found. Coverage Stats
💛 - Coveralls |
There was a problem hiding this comment.
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-linkelements when a.libkey-linkis present.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
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.
| // Remove result-get container (no fulfillment links) | ||
| parentElement.remove(); | ||
| } | ||
| }) |
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 | ||
| } |
Contributor
Author
There was a problem hiding this comment.
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. 🙃
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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
New ENV
Approval beyond code review
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
added technical debt.
Documentation
(not just this pull request message).
Testing