fix(react): 地图颜色大小的回调函数不会更新bug

This commit is contained in:
聆一 2020-02-27 08:05:54 +08:00
parent 2b9be52cfd
commit 2686c48881
2 changed files with 4 additions and 2 deletions

View File

@ -13,7 +13,8 @@ export default React.memo(function Chart(props: ILayerProps) {
color.field
? layer.color(color.field as StyleAttrField, color.values)
: layer.color(color.values as StyleAttrField);
}, [color.field, color.scale, JSON.stringify(color.values)]);
// TODO目前这种处理会频繁更新但是直接JSON.Stringify(size.values),回调函数不会更新,待优化
}, [color.field, color.scale, color.values]);
return null;
});

View File

@ -13,6 +13,7 @@ export default React.memo(function Chart(props: ILayerProps) {
size.field
? layer.size(size.field, size.values)
: layer.size(size.values as StyleAttrField);
}, [size.field, JSON.stringify(size.values), size.scale]);
// TODO目前这种处理会频繁更新但是直接JSON.Stringify(size.values),回调函数不会更新,待优化
}, [size.field, size.values, size.scale]);
return null;
});