fix(#3376193): use filter identifier when building preview URL - #13
fix(#3376193): use filter identifier when building preview URL#13Decipher wants to merge 2 commits into
Conversation
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Pro Plus Run ID: 📒 Files selected for processing (2)
📝 WalkthroughWalkthroughThe filter preview query now skips non-exposed filters, uses configured exposed identifiers, and includes values only when those identifiers exist. A kernel test verifies identifiers that differ from field names. ChangesExposed filter identifiers
Estimated code review effort: 2 (Simple) | ~10 minutes 🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
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 |
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## 8.x-1.x #13 +/- ##
========================================
Coverage 94.11% 94.11%
========================================
Files 3 3
Lines 136 136
========================================
Hits 128 128
Misses 8 8 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
Fixes #3376193.
Problem
jsonapi_views_views_preview_info_alter()keyed the exposed-inputlookup by filter field name. Views stores exposed input keyed by the
filter's identifier, which defaults to the field name but can differ.
When the identifier differs from the field name, the lookup hit an
undefined key. This logged a PHP warning on every preview and dropped
the filter from the previewed JSON:API Views URL.
Fix
Read each filter's identifier from
$filter->options['expose']['identifier'],fall back to
$filter->fieldfor the common case, and guard the arrayaccess with
isset().Credits
isset()follow-up(issue comments chore: apply drupal-extension-scaffold v4.16.1 #2 and Update circleci/php Docker tag to v7.4 #3). The fix commit is authored by them.
against current
8.x-1.x. The patch pre-dates thesprintfrefactorand the type-hinted signature, so it no longer applies cleanly.
Tests
Kernel coverage added. The test view already has a filter whose
identifier (
content_type) differs from its field name (type), so thetest reproduces the bug directly. It fails with
Undefined array key "type"on unfixed code and passes after the fix.Related
#3277489 is a duplicate report with a different approach and is already
closed.
Summary by CodeRabbit