Skip to content

Fix unreachable numberrange case in the filter widget - #1534

Open
darkdi wants to merge 1 commit into
wintercms:developfrom
darkdi:fix/filter-numberrange-unreachable-case
Open

Fix unreachable numberrange case in the filter widget#1534
darkdi wants to merge 1 commit into
wintercms:developfrom
darkdi:fix/filter-numberrange-unreachable-case

Conversation

@darkdi

@darkdi darkdi commented Sep 2, 2026

Copy link
Copy Markdown

renderScopeElement repeats case 'number' and case 'numberrange' inside one switch: once as a pair at the top of the shared min/max/step block, and once each below it. PHP jumps to the first label that matches, so the two lower ones are never entered on their own. A numberrange scope enters at the top pair, runs the shared block, falls through into the case 'number' body and breaks there, so minStr, min, maxStr and max never reach the partial and the range inputs render without their values.

The // no break comment shows the intent was a fallthrough into a per-type block, which is what a switch cannot do when the label is already above. I turned the two lower cases into a branch on $scope->type inside the shared block, so the shared parameters still apply to both and each type keeps its own half.

number scopes behave the same before and after: they used to reach that body by fallthrough, now they reach it through the elseif.

Summary by CodeRabbit

  • Bug Fixes
    • Improved filtering for numeric values.
    • Numeric filters now use the entered number correctly, while numeric range filters continue to support minimum and maximum values.

@coderabbitai

coderabbitai Bot commented Sep 2, 2026

Copy link
Copy Markdown

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Team

Run ID: b0833356-b866-48dc-a552-62c5aae65a43

📥 Commits

Reviewing files that changed from the base of the PR and between 49c2f65 and 7345cd4.

📒 Files selected for processing (1)
  • modules/backend/widgets/Filter.php

Included review availability: Your plan provides up to 4 included reviews per hour; 3 remain after this review.


Walkthrough

renderScopeElement now processes number and numberrange scopes separately. A numberrange scope sets range parameters only for a qualifying two-element array. A number scope sets the number parameter when its value is numeric. The previous fall-through behavior is removed.

Estimated code review effort: 2 (Simple) | ~10 minutes

Merge Risk: ⚪ Minimal · up to 7345c

The change restores numeric-range filter values while preserving existing number-filter behavior. No actionable merge-blocking risk remains beyond normal checks and review.

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly identifies the main change: fixing the unreachable numberrange case in the filter widget.
Docstring Coverage ✅ Passed Docstring coverage is 100.00% which is sufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 1 functions across 1 files.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

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.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

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.

1 participant