fix: external data source filterTargetKey undefined in filter action (#4815)

* fix: external data source filterTargetKey undefined in filter action

* fix: bug
This commit is contained in:
Katherine 2024-07-05 09:45:52 +08:00 committed by GitHub
parent cfcf9291dc
commit a754bcedd8
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -8,15 +8,20 @@
*/
import { ExclamationCircleTwoTone } from '@ant-design/icons';
import { useCollectionRecordData, useCompile } from '@nocobase/client';
import { useCollectionRecordData, useCompile, Input } from '@nocobase/client';
import { useField } from '@formily/react';
import { Popover } from 'antd';
import React from 'react';
import { SetFilterTargetKey } from './SetFilterTargetKey';
export const CollectionTitle = () => {
const record = useCollectionRecordData();
export const CollectionTitle = (props) => {
const record = useCollectionRecordData() || {};
const compile = useCompile();
if (record.filterTargetKey) {
const field = useField();
if (field.editable) {
return <Input {...props} />;
}
if (record?.filterTargetKey) {
return compile(record.title);
}
return (