-
Notifications
You must be signed in to change notification settings - Fork 1
Hide show more button when tag search is active #231
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
- Hide "show more" button when search input has text - Restore button visibility when search is cleared based on total tag count - Improve UX by removing unnecessary button during filtered search
|
Warning Rate limit exceeded@IhorMasechko has exceeded the limit for the number of commits or files that can be reviewed per hour. Please wait 0 minutes and 42 seconds before requesting another review. ⌛ How to resolve this issue?After the wait time has elapsed, a review can be triggered using the We recommend that you space out your commits to avoid hitting the rate limit. 🚦 How do rate limits work?CodeRabbit enforces hourly rate limits for each developer per organization. Our paid plans have higher rate limits than the trial, open-source and free plans. In all cases, we re-allow further reviews after a brief timeout. Please see our FAQ for further information. 📒 Files selected for processing (1)
WalkthroughAdded Possibly related PRs
Pre-merge checks✅ Passed checks (3 passed)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 0
Caution
Some comments are outside the diff and can’t be posted inline due to platform limitations.
⚠️ Outside diff range comments (1)
website/modules/asset/ui/src/searchInputHandler.js (1)
45-45: Eliminate duplicate computation ofisSearchActive.The same boolean
isSearchActive = filterValue.length > 0is computed in bothfilterTags(line 45) and the handler (line 103). The handler callsfilterTagswhich already computes it internally, then immediately recomputes the same value.🔎 Refactor to return isSearchActive from filterTags
Modify
filterTagsto return both values:const filterTags = function ( tagItems, filterValue, getLabel, defaultVisibleCount, ) { let hasVisible = false; const isSearchActive = filterValue.length > 0; tagItems.forEach(function (tag, index) { if (isSearchActive) { const match = getLabel(tag).includes(filterValue); if (match) { showTagItem(tag); hasVisible = true; } else { hideTagItem(tag); } } else if (index < defaultVisibleCount) { showTagItem(tag); hasVisible = true; } else { tag.style.display = ''; tag.classList.add('tag-item--hidden'); } }); - return hasVisible; + return { hasVisible, isSearchActive }; };Then update the handler to destructure the return value:
const handler = function () { const filterValue = input.value.trim().toLowerCase(); const container = input.closest(containerSelector); if (!container) return; const tagItems = container.querySelectorAll(tagSelector); - const isSearchActive = filterValue.length > 0; - const hasVisible = filterTags( + const { hasVisible, isSearchActive } = filterTags( tagItems, filterValue, getTagLabelFn, defaultVisibleCount, ); toggleNoTagsMessage(container, hasVisible);Also applies to: 103-103
📜 Review details
Configuration used: Organization UI
Review profile: ASSERTIVE
Plan: Pro
📒 Files selected for processing (1)
website/modules/asset/ui/src/searchInputHandler.js(1 hunks)
🧰 Additional context used
🧬 Code graph analysis (1)
website/modules/asset/ui/src/searchInputHandler.js (1)
website/modules/asset/ui/src/index.js (1)
container(31-31)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (4)
- GitHub Check: lint
- GitHub Check: security-scan
- GitHub Check: e2e-tests
- GitHub Check: unit-tests
🔍 Vulnerabilities of
|
| digest | sha256:105365c40411369d9a88f8cfd5e21783cb57c25d5b59109549c2257e3acd0376 |
| vulnerabilities | |
| platform | linux/amd64 |
| size | 291 MB |
| packages | 985 |
📦 Base Image node:23-alpine
| also known as |
|
| digest | sha256:b9d38d589853406ff0d4364f21969840c3e0397087643aef8eede40edbb6c7cd |
| vulnerabilities |
Description
| ||||||||||||||||||||||||
Description
Description
| ||||||||||||||||||||||||
Description
| ||||||||||||||||||||||||
Description
| ||||||||||||||||||||||||
Description
| ||||||||||||||||||||||||
Description
| ||||||||||||||||||||||||
Description
| ||||||||||||||||||||||||
Description
| ||||||||||||||||||||||||
Description
| ||||||||||||||||||||||||
Description
| ||||||||||||||||||||||||
Description
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 2
📜 Review details
Configuration used: Organization UI
Review profile: ASSERTIVE
Plan: Pro
📒 Files selected for processing (1)
website/modules/asset/ui/src/searchInputHandler.js(2 hunks)
🧰 Additional context used
🧬 Code graph analysis (1)
website/modules/asset/ui/src/searchInputHandler.js (1)
website/modules/asset/ui/src/index.js (2)
parsed(37-37)container(31-31)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (4)
- GitHub Check: security-scan
- GitHub Check: lint
- GitHub Check: unit-tests
- GitHub Check: e2e-tests
🔇 Additional comments (1)
website/modules/asset/ui/src/searchInputHandler.js (1)
54-54: > Likely an incorrect or invalid review comment.
- Fix no-ternary lint error by replacing ternary with if/else - Remove hardcoded .cs_container selector coupling - Eliminate redundant isSearchActive computation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 1
📜 Review details
Configuration used: Organization UI
Review profile: ASSERTIVE
Plan: Pro
📒 Files selected for processing (1)
website/modules/asset/ui/src/searchInputHandler.js(3 hunks)
🧰 Additional context used
🧬 Code graph analysis (1)
website/modules/asset/ui/src/searchInputHandler.js (1)
website/modules/asset/ui/src/index.js (2)
container(31-31)parsed(37-37)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (4)
- GitHub Check: security-scan
- GitHub Check: unit-tests
- GitHub Check: e2e-tests
- GitHub Check: lint
This change hides the "show more" button while the tag search input contains text and restores it when cleared, using container's defaultVisibleTags to decide visibility. It adds getDefaultVisibleCount, toggleShowMoreButtonVisibility, and an isSearchActive flag, refactors setupTagSearchForInput to use them, and updates filtering to show matches during search and limit visible tags otherwise.