fix: filter button nonfilterable field settings affecting other table block with the same collection (#6121)

This commit is contained in:
Katherine 2025-01-23 11:48:46 +08:00 committed by GitHub
parent c14530b9f5
commit 0b6ed37fa4
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -150,7 +150,7 @@ const field2option = (field, depth, nonfilterable, dataSourceManager, collection
return option; return option;
}; };
const getOptions = _.memoize((fields, depth, nonfilterable, dataSourceManager, collectionManager) => { const getOptions = (fields, depth, nonfilterable, dataSourceManager, collectionManager) => {
const options = []; const options = [];
fields.forEach((field) => { fields.forEach((field) => {
const option = field2option(field, depth, nonfilterable, dataSourceManager, collectionManager); const option = field2option(field, depth, nonfilterable, dataSourceManager, collectionManager);
@ -159,7 +159,7 @@ const getOptions = _.memoize((fields, depth, nonfilterable, dataSourceManager, c
} }
}); });
return options; return options;
}); };
export const useFilterFieldOptions = (fields) => { export const useFilterFieldOptions = (fields) => {
const fieldSchema = useFieldSchema(); const fieldSchema = useFieldSchema();
@ -192,6 +192,7 @@ export const removeNullCondition = (filter, customFlat = flat) => {
export const useFilterActionProps = () => { export const useFilterActionProps = () => {
const collection = useCollection(); const collection = useCollection();
const options = useFilterOptions(collection?.name); const options = useFilterOptions(collection?.name);
console.log(options);
const props = useDataBlockProps(); const props = useDataBlockProps();
return useFilterFieldProps({ options, params: props?.params }); return useFilterFieldProps({ options, params: props?.params });
}; };