diff --git a/packages/builder/src/components/design/settings/controls/FilterEditor/FilterDrawer.svelte b/packages/builder/src/components/design/settings/controls/FilterEditor/FilterDrawer.svelte index 32211212d0..42a9d5773e 100644 --- a/packages/builder/src/components/design/settings/controls/FilterEditor/FilterDrawer.svelte +++ b/packages/builder/src/components/design/settings/controls/FilterEditor/FilterDrawer.svelte @@ -195,20 +195,8 @@ return [] } - let type = filter.type - if (type === FieldType.BB_REFERENCE) { - const fieldSchema = getSchema(filter) - if (fieldSchema) { - type = { - type: fieldSchema.type, - multiple: - fieldSchema.relationshipType === RelationshipType.MANY_TO_MANY, - } - } - } - const operators = LuceneUtils.getValidOperatorsForType( - type, + filter.type, filter.field, datasource ) diff --git a/packages/shared-core/src/filters.ts b/packages/shared-core/src/filters.ts index 9f883d8f25..6ab8ce623e 100644 --- a/packages/shared-core/src/filters.ts +++ b/packages/shared-core/src/filters.ts @@ -12,22 +12,12 @@ import { deepGet } from "./helpers" const HBS_REGEX = /{{([^{].*?)}}/g -type RequestedFieldType = - | Exclude - | { type: FieldType.BB_REFERENCE; multiple: boolean } - -export function isFieldType( - r: RequestedFieldType -): r is Exclude { - return typeof r === "string" && Object.values(FieldType).includes(r) -} - /** * Returns the valid operator options for a certain data type * @param type the data type */ export const getValidOperatorsForType = ( - type: RequestedFieldType, + type: FieldType, field: string, datasource: Datasource & { tableId: any } // TODO: is this table id ever populated? ) => { @@ -70,13 +60,8 @@ export const getValidOperatorsForType = ( ops = numOps } else if (type === FieldType.FORMULA) { ops = stringOps.concat([Op.MoreThan, Op.LessThan]) - } else if (!isFieldType(type) && type.type === FieldType.BB_REFERENCE) { - if (type.multiple) { - // Temporally disabled - ops = [] - } else { - ops = [Op.Equals, Op.NotEquals, Op.Empty, Op.NotEmpty, Op.In] - } + } else if (type === FieldType.BB_REFERENCE) { + ops = [Op.Equals, Op.NotEquals, Op.Empty, Op.NotEmpty, Op.In] } // Only allow equal/not equal for _id in SQL tables