Skip to content

Commit c1838ef

Browse files
committed
fix: use ref change to apply notMerge: true for setOption
1 parent cdc6ed5 commit c1838ef

File tree

1 file changed

+9
-16
lines changed

1 file changed

+9
-16
lines changed

src/ECharts.ts

Lines changed: 9 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -86,10 +86,9 @@ export default defineComponent({
8686
const realInitOptions = computed(
8787
() => props.initOptions || unref(defaultInitOptions) || {}
8888
);
89-
const realUpdateOptions = computed(() => ({
90-
...(props.updateOptions || unref(defaultUpdateOptions) || {}),
91-
notMerge: true
92-
}));
89+
const realUpdateOptions = computed(
90+
() => props.updateOptions || unref(defaultUpdateOptions) || {}
91+
);
9392
const nonEventAttrs = computed(() => omitOn(attrs));
9493

9594
function init(option?: Option) {
@@ -137,16 +136,7 @@ export default defineComponent({
137136

138137
function resize() {
139138
if (instance && !instance.isDisposed()) {
140-
// temporarily suppress errors caused by https://github.com/apache/echarts/issues/14846
141-
try {
142-
instance.resize();
143-
} catch (e) {
144-
if (e.message === "Cannot read property 'get' of undefined") {
145-
return;
146-
}
147-
148-
throw e;
149-
}
139+
instance.resize();
150140
}
151141
}
152142

@@ -197,14 +187,17 @@ export default defineComponent({
197187
if (!manualUpdate) {
198188
unwatchOption = watch(
199189
() => props.option,
200-
option => {
190+
(option, oldOption) => {
201191
if (!option) {
202192
return;
203193
}
204194
if (!chart.value) {
205195
init();
206196
} else {
207-
chart.value.setOption(option, realUpdateOptions.value);
197+
chart.value.setOption(option, {
198+
...realUpdateOptions.value,
199+
notMerge: option.value !== oldOption?.value
200+
});
208201
}
209202
},
210203
{ deep: true }

0 commit comments

Comments
 (0)