fix: data loaded

This commit is contained in:
chenos 2022-06-09 11:12:07 +08:00
parent 1921b2be31
commit 8583af232d

View File

@ -62,12 +62,14 @@ export const G2Plot: any = observer((props: any) => {
const { t } = useTranslation();
useEffect(() => {
field.data = field.data || {};
field.data.loaded = false;
if (typeof config?.data?.then === 'function') {
field.data.loaded = false;
config?.data?.then((data) => {
field.componentProps.config.data = data;
field.data.loaded = true;
});
} else {
field.data.loaded = true;
}
}, []);
if (!plot || !config) {