Skip to content

Commit fdf68f0

Browse files
committed
Fixed: lazyUpdate error
1 parent cf92800 commit fdf68f0

File tree

3 files changed

+13
-5
lines changed

3 files changed

+13
-5
lines changed

docs/bar.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,7 @@ export default () => {
7171
},
7272
};
7373

74-
return <EChartsNextForReactCore option={option} />;
74+
return <EChartsNextForReactCore lazyUpdate={true} option={option} />;
7575
};
7676
```
7777

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "echarts-next-for-react",
3-
"version": "1.0.7",
3+
"version": "1.0.8",
44
"description": "Echarts(v5.x | next) components for react.",
55
"main": "dist/index.js",
66
"module": "dist/index.esm.js",

src/index.tsx

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ const EChartsNextForReactCore: FC<EChartsNextForReactCoreProps> = (props) => {
5858
const getChartDom = () => {
5959
const chartObj = getChartInstance();
6060
if (chartObj) {
61-
chartObj.setOption(option, notMerge ?? false, lazyUpdate ?? false);
61+
chartObj.setOption(option, notMerge ?? false, !!lazyUpdate ?? false);
6262
if (showLoading) {
6363
chartObj.showLoading();
6464
} else {
@@ -124,8 +124,16 @@ const EChartsNextForReactCore: FC<EChartsNextForReactCoreProps> = (props) => {
124124

125125
useEffect(() => {
126126
const chartDom = getChartDom();
127-
if (chartDom) {
128-
chartDom.resize();
127+
// @ts-ignore
128+
if (chartDom?._dom) {
129+
// @ts-ignore
130+
bind(chartDom._dom, () => {
131+
try {
132+
chartDom?.resize();
133+
} catch (e) {
134+
console.error(e);
135+
}
136+
});
129137
}
130138
}, [style, className, showLoading]);
131139

0 commit comments

Comments
 (0)