Fix for export component loading documents before opened

This commit is contained in:
francesco
2021-06-21 12:23:19 +02:00
parent d731f406dd
commit 3fece9ffe9
3 changed files with 8 additions and 5 deletions

View File

@@ -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);

View File

@@ -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,

View File

@@ -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;
}