Skip to content

fix: dont add terms when they are empty in taxonomyTermSlugs#136

Merged
laravdiemen merged 1 commit into
mainfrom
fix/empty-taxonomy-terms
Apr 9, 2026
Merged

fix: dont add terms when they are empty in taxonomyTermSlugs#136
laravdiemen merged 1 commit into
mainfrom
fix/empty-taxonomy-terms

Conversation

@laravdiemen
Copy link
Copy Markdown
Contributor

Dit lost een bug op. Stappen om de bug te reproduceren:

  1. Selecteer een taxonomy filter (Voorbeeld taxonomy "Thema" en dan waarde "Talentontwikkling")
  2. Verwijder die filter ("Talentontwikkling") weer
  3. Selecteer een andere taxonomy (Voorbeeld taxonomy "Type" en dan waarde "Gesteund project")
  4. Sla de pagina op
  5. Bekijk de pagina aan de voorkant

In de editor gaat het gewoon goed, maar aan de voorkant krijg je de melding dat er geen resulaten zijn.

Als je dan in de code editor kijkt, dan zie je dit. Het gaat hier fout omdat news_theme een lege array is. Deze PR fixt dit probleem.

<!-- wp:yard/query {"postTypes":[{"label":"Nieuwsberichten","value":"news"}],"stickyPost":[],"postParent":[],"enableTaxonomies":true,"taxonomyTerms":{"news_theme":[],"news_type":[{"label":"Gesteund project","value":"gesteund-project"}]}} /-->

@github-actions
Copy link
Copy Markdown

github-actions Bot commented Apr 8, 2026

Coverage report for commit: acfc9d9
File: coverage.xml

Cover ┌─────────────────────────┐ Freq.
   0% │ ███████████████████████ │ 42.9%
  10% │ ░░░░░░░░░░░░░░░░░░░░░░░ │  0.0%
  20% │ ░░░░░░░░░░░░░░░░░░░░░░░ │  0.0%
  30% │ ░░░░░░░░░░░░░░░░░░░░░░░ │  0.0%
  40% │ ░░░░░░░░░░░░░░░░░░░░░░░ │  0.0%
  50% │ ████████░░░░░░░░░░░░░░░ │ 14.3%
  60% │ ░░░░░░░░░░░░░░░░░░░░░░░ │  0.0%
  70% │ ░░░░░░░░░░░░░░░░░░░░░░░ │  0.0%
  80% │ ░░░░░░░░░░░░░░░░░░░░░░░ │  0.0%
  90% │ ████████░░░░░░░░░░░░░░░ │ 14.3%
 100% │ ████████████████░░░░░░░ │ 28.6%
      └─────────────────────────┘
 *Legend:* █ = Current Distribution 
Summary - Lines: 30.68% | Methods: 58.49%
FilesLinesMethodsBranches
src/Block
   Block.php--100.00%
   BlockAttributes.php92.75%93.55%100.00%
src/Casts
   IntCast.php50.00%-100.00%
src/Query
   PostQuery.php--100.00%
   QueryInterface.php100.00%100.00%100.00%
src
   QueryBlockServiceProvider.php--100.00%
src/Traits
   Helpers.php100.00%100.00%100.00%

🤖 comment via lucassabreu/comment-coverage-clover

Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR fixes a frontend “no results” bug by preventing empty taxonomy term selections (e.g., news_theme: []) from being included when building taxonomy term slug filters.

Changes:

  • Skip taxonomies whose $terms array is empty when computing taxonomyTermSlugs(), avoiding empty taxonomy filters being applied.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread src/Block/BlockAttributes.php
@laravdiemen laravdiemen force-pushed the fix/empty-taxonomy-terms branch from e7caf19 to 547e7a9 Compare April 8, 2026 10:16
Comment thread src/Block/BlockAttributes.php Outdated
@laravdiemen laravdiemen force-pushed the fix/empty-taxonomy-terms branch from 547e7a9 to acfc9d9 Compare April 8, 2026 13:28
@laravdiemen laravdiemen merged commit 5685ccd into main Apr 9, 2026
5 checks passed
@laravdiemen laravdiemen deleted the fix/empty-taxonomy-terms branch April 9, 2026 07:43
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.

5 participants