Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Enable array filtering #8538

Merged
merged 1 commit into from
Nov 18, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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';
Loading