Skip to content

Commit

Permalink
Enable array filtering (#8538)
Browse files Browse the repository at this point in the history
- Set array filtering always enabled
- Rename `IS_ARRAY_AND_JSON_FILTER_ENABLED ` TO
`IS_JSON_FILTER_ENABLED`.
  • Loading branch information
ad-elias authored Nov 18, 2024
1 parent 9134ed8 commit ef5cc80
Show file tree
Hide file tree
Showing 5 changed files with 12 additions and 17 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -24,13 +24,11 @@ export const useColumnDefinitionsFromFieldMetadata = (
[objectMetadataItem],
);

const isArrayAndJsonFilterEnabled = useIsFeatureEnabled(
'IS_ARRAY_AND_JSON_FILTER_ENABLED',
);
const isJsonFilterEnabled = useIsFeatureEnabled('IS_JSON_FILTER_ENABLED');

const filterDefinitions = formatFieldMetadataItemsAsFilterDefinitions({
fields: activeFieldMetadataItems,
isArrayAndJsonFilterEnabled,
isJsonFilterEnabled,
});

const sortDefinitions = formatFieldMetadataItemsAsSortDefinitions({
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,10 @@ import { ObjectMetadataItem } from '../types/ObjectMetadataItem';

export const formatFieldMetadataItemsAsFilterDefinitions = ({
fields,
isArrayAndJsonFilterEnabled,
isJsonFilterEnabled,
}: {
fields: Array<ObjectMetadataItem['fields'][0]>;
isArrayAndJsonFilterEnabled: boolean;
isJsonFilterEnabled: boolean;
}): FilterDefinition[] => {
return fields.reduce((acc, field) => {
if (
Expand Down Expand Up @@ -40,9 +40,8 @@ export const formatFieldMetadataItemsAsFilterDefinitions = ({
FieldMetadataType.Rating,
FieldMetadataType.Actor,
FieldMetadataType.Phones,
...(isArrayAndJsonFilterEnabled
? [FieldMetadataType.Array, FieldMetadataType.RawJson]
: []),
FieldMetadataType.Array,
...(isJsonFilterEnabled ? [FieldMetadataType.RawJson] : []),
].includes(field.type)
) {
return acc;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,15 +20,13 @@ export const useQueryVariablesFromActiveFieldsOfViewOrDefaultView = ({
objectMetadataItem,
});

const isArrayAndJsonFilterEnabled = useIsFeatureEnabled(
'IS_ARRAY_AND_JSON_FILTER_ENABLED',
);
const isJsonFilterEnabled = useIsFeatureEnabled('IS_JSON_FILTER_ENABLED');

const { filter, orderBy } = getQueryVariablesFromView({
fieldMetadataItems: activeFieldMetadataItems,
objectMetadataItem,
view,
isArrayAndJsonFilterEnabled,
isJsonFilterEnabled,
});

return {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,12 +13,12 @@ export const getQueryVariablesFromView = ({
view,
fieldMetadataItems,
objectMetadataItem,
isArrayAndJsonFilterEnabled,
isJsonFilterEnabled,
}: {
view: View | null | undefined;
fieldMetadataItems: FieldMetadataItem[];
objectMetadataItem: ObjectMetadataItem;
isArrayAndJsonFilterEnabled: boolean;
isJsonFilterEnabled: boolean;
}) => {
if (!isDefined(view)) {
return {
Expand All @@ -31,7 +31,7 @@ export const getQueryVariablesFromView = ({

const filterDefinitions = formatFieldMetadataItemsAsFilterDefinitions({
fields: fieldMetadataItems,
isArrayAndJsonFilterEnabled,
isJsonFilterEnabled,
});

const sortDefinitions = formatFieldMetadataItemsAsSortDefinitions({
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ export type FeatureFlagKey =
| 'IS_ANALYTICS_V2_ENABLED'
| 'IS_SSO_ENABLED'
| 'IS_UNIQUE_INDEXES_ENABLED'
| 'IS_ARRAY_AND_JSON_FILTER_ENABLED'
| 'IS_JSON_FILTER_ENABLED'
| 'IS_MICROSOFT_SYNC_ENABLED'
| 'IS_ADVANCED_FILTERS_ENABLED'
| 'IS_AGGREGATE_QUERY_ENABLED';

0 comments on commit ef5cc80

Please sign in to comment.