From fb55cd1b331abf5a6cc13b8e1fa910747fd925ca Mon Sep 17 00:00:00 2001 From: MaysWind Date: Sat, 20 Dec 2025 00:40:58 +0800 Subject: [PATCH] do not switch expression when there are no conditions --- src/models/explore.ts | 4 ++++ src/views/desktop/insights/tabs/ExploreQueryTab.vue | 7 ++++--- 2 files changed, 8 insertions(+), 3 deletions(-) diff --git a/src/models/explore.ts b/src/models/explore.ts index 810f4940..9ad73fe4 100644 --- a/src/models/explore.ts +++ b/src/models/explore.ts @@ -105,6 +105,10 @@ export class TransactionExploreQuery { } public toExpression(allCategoriesMap: Record, allAccountsMap: Record, allTagsMap: Record): string { + if (!this.conditions || this.conditions.length < 1) { + return ''; + } + const postfixExprTokens = this.getPostfixExprTokens(); const stack: ExpressionNode[] = []; diff --git a/src/views/desktop/insights/tabs/ExploreQueryTab.vue b/src/views/desktop/insights/tabs/ExploreQueryTab.vue index be3bce0d..708df421 100644 --- a/src/views/desktop/insights/tabs/ExploreQueryTab.vue +++ b/src/views/desktop/insights/tabs/ExploreQueryTab.vue @@ -16,6 +16,7 @@ {{ tt('Query') }} {{ `#${queryIndex + 1}` }} @@ -40,7 +41,7 @@ {{ tt('No conditions defined. All transactions will match.') }} -
+
-
+
@@ -592,7 +593,7 @@ function updateTransactionCategories(changed: boolean, selectedCategoryIds?: str function getExpression(queryIndex: number): string { const query = queries.value[queryIndex]; - if (!query) { + if (!query || !query.conditions || query.conditions.length < 1) { return ''; }