fix: l7 react source update 机制

This commit is contained in:
thinkinggis 2020-02-24 14:54:29 +08:00
parent 9abd412c80
commit 2954345f3f
4 changed files with 4 additions and 4 deletions

View File

@ -12,6 +12,6 @@ export default React.memo(function Chart(props: ILayerProps) {
const { layer, active } = props; const { layer, active } = props;
useEffect(() => { useEffect(() => {
layer.active(active.option); layer.active(active.option);
}, [active, layer]); }, [JSON.stringify(active)]);
return null; return null;
}); });

View File

@ -13,6 +13,6 @@ export default React.memo(function Chart(props: ILayerProps) {
if (filter.field) { if (filter.field) {
layer.filter(filter.field as string, filter.values as StyleAttrField); layer.filter(filter.field as string, filter.values as StyleAttrField);
} }
}, [filter.field, JSON.stringify(filter.values), filter.values]); }, [filter.field, JSON.stringify(filter.values)]);
return null; return null;
}); });

View File

@ -13,6 +13,6 @@ export default React.memo(function Chart(props: ILayerProps) {
size.field size.field
? layer.size(size.field, size.values) ? layer.size(size.field, size.values)
: layer.size(size.values as StyleAttrField); : layer.size(size.values as StyleAttrField);
}, [size.field, size.values, size.scale]); }, [size.field, JSON.stringify(size.values), size.scale]);
return null; return null;
}); });

View File

@ -17,6 +17,6 @@ export default React.memo(function Chart(props: ISourceProps) {
} else { } else {
layer.setData(data, sourceOption); layer.setData(data, sourceOption);
} }
}, [data, sourceOption]); }, [data, JSON.stringify(sourceOption)]);
return null; return null;
}); });