mirror of
https://github.com/zhigang1992/firecms.git
synced 2026-06-19 18:03:20 +08:00
Fix for export component loading documents before opened
This commit is contained in:
@@ -18,7 +18,6 @@ import {
|
||||
DialogTitle,
|
||||
IconButton,
|
||||
Tooltip,
|
||||
useMediaQuery,
|
||||
useTheme
|
||||
} from "@material-ui/core";
|
||||
import { CSVLink } from "react-csv";
|
||||
@@ -45,9 +44,11 @@ export default function ExportButton<S extends EntitySchema<Key>, Key extends st
|
||||
const [dataLoadingError, setDataLoadingError] = React.useState<Error | undefined>();
|
||||
|
||||
const [open, setOpen] = React.useState(false);
|
||||
const theme = useTheme();
|
||||
|
||||
useEffect(() => {
|
||||
|
||||
if (!open) return;
|
||||
|
||||
setDataLoading(true);
|
||||
|
||||
const updateEntities = async (entities: Entity<S, Key>[]) => {
|
||||
@@ -91,7 +92,7 @@ export default function ExportButton<S extends EntitySchema<Key>, Key extends st
|
||||
undefined,
|
||||
undefined);
|
||||
|
||||
}, [collectionPath, schema]);
|
||||
}, [collectionPath, schema, open]);
|
||||
|
||||
const handleClickOpen = () => {
|
||||
setOpen(true);
|
||||
|
||||
@@ -212,7 +212,7 @@ function FieldInternal<T extends CMSType, S extends EntitySchema<Key> = EntitySc
|
||||
showError,
|
||||
isSubmitting,
|
||||
includeDescription: includeDescription ?? true,
|
||||
property: property as Property<T>,
|
||||
property: property,
|
||||
disabled: disabled ?? false,
|
||||
underlyingValueHasChanged: underlyingValueHasChanged ?? false,
|
||||
tableMode: tableMode ?? false,
|
||||
|
||||
@@ -180,7 +180,9 @@ export interface CMSFormFieldProps<T extends CMSType, S extends EntitySchema<Key
|
||||
|
||||
/**
|
||||
* This flag is used to avoid using Formik FastField internally, which
|
||||
* prevents being updated from the values
|
||||
* prevents being updated from the values.
|
||||
* Set this value to `true` if you are developing a custom field which
|
||||
* value gets updated dynamically based on others.
|
||||
*/
|
||||
dependsOnOtherProperties?: boolean;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user