fix: url query parameter operator issue (#6770)

* fix: url query parameter operator issue

* fix: test
This commit is contained in:
Katherine 2025-04-25 15:09:32 +08:00 committed by GitHub
parent cf57be8fb4
commit 9ae303844d
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
3 changed files with 4 additions and 2 deletions

View File

@ -44,7 +44,7 @@ const findOption = (str, options) => {
// 进入下一层 children 查找
if (Array.isArray(option.children) || option.isLeaf === false) {
currentOptions = option.children || option.field.children;
currentOptions = option.children || option?.field?.children || [];
} else {
return option; // 没有 children 直接返回
}

View File

@ -24,7 +24,7 @@ test('getURLSearchParamsChildren should return an array of options with expected
const result = getURLSearchParamsChildren(queryParams);
expect(result).toEqual([
expect(result).toMatchObject([
{
label: 'param1',
value: 'param1',

View File

@ -16,6 +16,7 @@ import { useLocationSearch } from '../../../application/CustomRouterContextProvi
import { useFlag } from '../../../flag-provider/hooks/useFlag';
import { Option } from '../type';
import { getLabelWithTooltip } from './useBaseVariable';
import { string } from '../../../collection-manager/interfaces/properties/operators';
export const getURLSearchParams = (search: string) => {
if (search.startsWith('?')) {
@ -32,6 +33,7 @@ export const getURLSearchParamsChildren = (queryParams: Record<string, any>): Op
value: key,
key,
isLeaf: true,
operators: string,
};
});
};