- Notifications
You must be signed in to change notification settings - Fork501
fix: filter count badge displaying incorrect count for empty filters#3882
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 ourterms of service andprivacy statement. We’ll occasionally send you account related emails.
Already on GitHub?Sign in to your account
base:master
Are you sure you want to change the base?
fix: filter count badge displaying incorrect count for empty filters#3882
Conversation
CLAassistant commentedNov 19, 2025
dhruv-suthar seems not to be a GitHub user. You need a GitHub account to be able to sign the CLA. If you have already a GitHub account, pleaseadd the email address used for this commit to your account. You have signed the CLA already but the status is still pending? Let usrecheck it. |
coderabbitaibot commentedNov 19, 2025 • edited
Loading Uh oh!
There was an error while loading.Please reload this page.
edited
Uh oh!
There was an error while loading.Please reload this page.
WalkthroughThe Estimated code review effort🎯 2 (Simple) | ⏱️ ~10 minutes
Pre-merge checks and finishing touches❌ Failed checks (1 inconclusive)
✅ Passed checks (2 passed)
✨ Finishing touches
🧪 Generate unit tests (beta)
Thanks for usingCodeRabbit! 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
🧹 Nitpick comments (1)
app/src/components/features/rules/RulePairs/Pairs/Rows/RowsMarkup/RequestSourceRow/index.js (1)
83-87:Consider moving COUNTABLE_FILTERS outside the callback.The constant is recreated on every render inside
useCallback. Since it's static, moving it outside the component (or at least outside the callback) would improve performance slightly.Move the constant to module scope:
+const COUNTABLE_FILTERS = [+ GLOBAL_CONSTANTS.RULE_SOURCE_FILTER_TYPES.REQUEST_METHOD,+ GLOBAL_CONSTANTS.RULE_SOURCE_FILTER_TYPES.RESOURCE_TYPE,+ GLOBAL_CONSTANTS.RULE_SOURCE_FILTER_TYPES.PAGE_DOMAINS,+];+ const RequestSourceRow = ({ rowIndex, pair, pairIndex, ruleDetails, isInputDisabled }) => {And remove lines 83-87 from inside the callback.
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (1)
app/src/components/features/rules/RulePairs/Pairs/Rows/RowsMarkup/RequestSourceRow/index.js(1 hunks)
🧰 Additional context used
🧬 Code graph analysis (1)
app/src/components/features/rules/RulePairs/Pairs/Rows/RowsMarkup/RequestSourceRow/index.js (2)
app/src/components/features/rules/RulePairs/Filters/index.jsx (1)
currentlySelectedRuleData(65-65)app/src/components/features/rules/RulePairs/index.js (1)
currentlySelectedRuleData(18-18)
🔇 Additional comments (2)
app/src/components/features/rules/RulePairs/Pairs/Rows/RowsMarkup/RequestSourceRow/index.js (2)
73-79:LGTM! Solid defensive checks.The filter retrieval logic correctly handles both upgraded and legacy formats with optional chaining, and the type guard prevents errors when filters are missing or invalid. This directly addresses the bug where empty filters would display an incorrect count.
89-92:Excellent fix for the filter count bug!The logic correctly counts only non-empty array filters by explicitly checking
Array.isArray(value) && value.length > 0. This fixes the bug where empty filters would incorrectly display "1 applied filter" by ensuring only populated filters contribute to the count.
nafees87n left a 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.
Looks good to be merged
Thanks for the PR@dhruv-suthar.
nafees87n commentedNov 26, 2025
@dhruv-suthar Please sign theCLA here so that the PR can be merged |
dhruv-suthar commentedNov 28, 2025
@nafees87n done signed. |
Uh oh!
There was an error while loading.Please reload this page.
Closes issue:#3826
📜 Summary of changes:
✅ Checklist:
🎥 Demo Video:
Video/Demo:
https://github.com/user-attachments/assets/375d55df-f994-4be0-ba42-db5abd519d85
Summary by CodeRabbit
Bug Fixes