Fix(ui): Failing Playwright Custom Property (#22680)

This commit is contained in:
Dhruv Parmar 2025-08-01 09:55:06 +05:30 committed by GitHub
parent 5057f29efc
commit 8aef65148f
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -13,12 +13,13 @@
import {
Config,
Field,
FieldOrGroup,
ImmutableTree,
OldJsonTree,
Utils as QbUtils,
ValueSource,
} from '@react-awesome-query-builder/antd';
import { isEmpty, isEqual, isNil, isString } from 'lodash';
import { get, isEmpty, isEqual, isNil, isString } from 'lodash';
import Qs from 'qs';
import {
createContext,
@ -29,6 +30,7 @@ import {
useState,
} from 'react';
import { useNavigate } from 'react-router-dom';
import { EntityType } from '../../../enums/entity.enum';
import { SearchIndex } from '../../../enums/search.enum';
import useCustomLocation from '../../../hooks/useCustomLocation/useCustomLocation';
import { TabsInfoData } from '../../../pages/ExplorePage/ExplorePage.interface';
@ -224,14 +226,18 @@ export const AdvanceSearchProvider = ({
}, [navigate, location.pathname]);
const fetchCustomPropertyType = async () => {
const subfields: Record<string, Field> = {};
const subfields: Record<string, FieldOrGroup> = {};
try {
const res = await getAllCustomProperties();
Object.entries(res).forEach(([resEntityType, fields]) => {
// If entityType is specified, only include custom properties for that entity type
if (entityType && resEntityType !== entityType) {
if (
entityType &&
entityType !== EntityType.ALL &&
resEntityType !== entityType
) {
return;
}
@ -263,8 +269,11 @@ export const AdvanceSearchProvider = ({
resEntityType.charAt(0).toUpperCase() +
resEntityType.slice(1),
type: '!group',
subfields: entitySubfields,
} as Field;
subfields: {
...get(subfields[resEntityType], 'subfields', {}),
...entitySubfields,
},
};
}
}
}