The open alternative to Salesforce, designed for AI.
TypeScript crmcrm-systemcustomergood-first-issuegraphqlhacktoberfestjavascriptmarketingmonoreponestjsopen-sourcepostgresqlreactreactjssalestypescriptweb
Fix IN filter with empty array (#7202)
Weikod8e16cbfd12e
diff --git a/packages/twenty-front/src/modules/settings/accounts/components/SettingsAccountsMessageChannelsContainer.tsx b/packages/twenty-front/src/modules/settings/accounts/components/SettingsAccountsMessageChannelsContainer.tsxindex 3bbe93deb53..d2d15d02fda 100644--- a/packages/twenty-front/src/modules/settings/accounts/components/SettingsAccountsMessageChannelsContainer.tsx+++ b/packages/twenty-front/src/modules/settings/accounts/components/SettingsAccountsMessageChannelsContainer.tsx@@ -44,6 +44,7 @@ export const SettingsAccountsMessageChannelsContainer = () => {in: accounts.map((account) => account.id),},},+ skip: !accounts.length,});const tabs = [diff --git a/packages/twenty-server/src/engine/api/graphql/graphql-query-runner/graphql-query-parsers/graphql-query-filter/graphql-query-filter-field.parser.ts b/packages/twenty-server/src/engine/api/graphql/graphql-query-runner/graphql-query-parsers/graphql-query-filter/graphql-query-filter-field.parser.tsindex e3f4a8348b6..fe37c4d445d 100644--- a/packages/twenty-server/src/engine/api/graphql/graphql-query-runner/graphql-query-parsers/graphql-query-filter/graphql-query-filter-field.parser.ts+++ b/packages/twenty-server/src/engine/api/graphql/graphql-query-runner/graphql-query-parsers/graphql-query-filter/graphql-query-filter-field.parser.ts@@ -1,4 +1,3 @@-import { isArray } from 'class-validator';import { ObjectLiteral, WhereExpressionBuilder } from 'typeorm';import { FieldMetadataInterface } from 'src/engine/metadata-modules/field-metadata/interfaces/field-metadata.interface';@@ -49,8 +48,13 @@ export class GraphqlQueryFilterFieldParser {}const [[operator, value]] = Object.entries(filterValue);- if (operator === 'in' && (!isArray(value) || value.length === 0)) {- return;+ if (operator === 'in') {+ if (!Array.isArray(value) || value.length === 0) {+ throw new GraphqlQueryRunnerException(+ `Invalid filter value for field ${key}. Expected non-empty array`,+ GraphqlQueryRunnerExceptionCode.INVALID_QUERY_INPUT,+ );+ }}const { sql, params } = this.computeWhereConditionParts(