[PR #4051] [MERGED] fix: any rule not accounting for empty filter #5165

Closed
opened 2026-02-28 21:07:10 -06:00 by GiteaMirror · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/actualbudget/actual/pull/4051
Author: @douugdev
Created: 12/28/2024
Status: Merged
Merged: 1/8/2025
Merged by: @matt-fidd

Base: masterHead: fix/filters-wrong-any-rule


📝 Commits (5)

  • 041feb1 fix: any rule not accounting for empty filter
  • 6e9f5df chore: add changelog
  • 44c7e46 Merge branch 'master' into fix/filters-wrong-any-rule
  • 318a12f Merge branch 'master' into fix/filters-wrong-any-rule
  • 5134d69 Merge branch 'master' into fix/filters-wrong-any-rule

📊 Changes

2 files changed (+7 additions, -1 deletions)

View changed files

📝 packages/loot-core/src/server/aql/compiler.ts (+1 -1)
upcoming-release-notes/4051.md (+6 -0)

📄 Description

Fixes #3982, that bug didn't only occur in the summary report, it also ocurred everywhere where there are filters that allow you to switch from "all" to "any" clauses.

For example in custom reports:

When you started filtering, switched to the "any" clause and then removed the conditions, the report would "crash" and never display any value because the compiler was inserting a AND 0 statement in the WHERE condition of the SQL. See:
https://github.com/user-attachments/assets/6e02f703-bb52-4b0c-88a3-ffe2c7e66a43

The bug was in the condition not accounting for empty arrays, it checked if(!cond) but if an empty array was passed, it was seem as a truthy value, because, for some reason, !![] is a truthy value in JavaScript 🤷.

After the fix:
https://github.com/user-attachments/assets/3d656330-3c6f-4243-a961-ad4f92aa5343


🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/actualbudget/actual/pull/4051 **Author:** [@douugdev](https://github.com/douugdev) **Created:** 12/28/2024 **Status:** ✅ Merged **Merged:** 1/8/2025 **Merged by:** [@matt-fidd](https://github.com/matt-fidd) **Base:** `master` ← **Head:** `fix/filters-wrong-any-rule` --- ### 📝 Commits (5) - [`041feb1`](https://github.com/actualbudget/actual/commit/041feb1a8eca024393cefd94fbbfd6c54e1aefa1) fix: any rule not accounting for empty filter - [`6e9f5df`](https://github.com/actualbudget/actual/commit/6e9f5df8b8960112d380495ccca056719bd7f1a6) chore: add changelog - [`44c7e46`](https://github.com/actualbudget/actual/commit/44c7e46e9750a759ecb0ee673817391beeb5f39b) Merge branch 'master' into fix/filters-wrong-any-rule - [`318a12f`](https://github.com/actualbudget/actual/commit/318a12f38baf9cf1e9617930abfd9f2e780e9a7c) Merge branch 'master' into fix/filters-wrong-any-rule - [`5134d69`](https://github.com/actualbudget/actual/commit/5134d69479a126f6506fcf632619cce951f56544) Merge branch 'master' into fix/filters-wrong-any-rule ### 📊 Changes **2 files changed** (+7 additions, -1 deletions) <details> <summary>View changed files</summary> 📝 `packages/loot-core/src/server/aql/compiler.ts` (+1 -1) ➕ `upcoming-release-notes/4051.md` (+6 -0) </details> ### 📄 Description Fixes #3982, that bug didn't only occur in the summary report, it also ocurred everywhere where there are filters that allow you to switch from "all" to "any" clauses. For example in custom reports: When you started filtering, switched to the "any" clause and then removed the conditions, the report would "crash" and never display any value because the compiler was inserting a `AND 0` statement in the `WHERE` condition of the SQL. See: https://github.com/user-attachments/assets/6e02f703-bb52-4b0c-88a3-ffe2c7e66a43 The bug was in the condition not accounting for empty arrays, it checked `if(!cond)` but if an empty array was passed, it was seem as a truthy value, because, for some reason, `!![]` is a truthy value in JavaScript 🤷. After the fix: https://github.com/user-attachments/assets/3d656330-3c6f-4243-a961-ad4f92aa5343 --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
GiteaMirror added the pull-request label 2026-02-28 21:07:10 -06:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: github-starred/actual#5165