Skip to content

Commit

Permalink
fix: 修复切换保存导致的递归引用问题 (#4129)
Browse files Browse the repository at this point in the history
Co-authored-by: cjyscjys <[email protected]>
Co-authored-by: wencong1724427771 <[email protected]>
Co-authored-by: chenmanting1 <[email protected]>
Co-authored-by: jayjiahua <[email protected]>
Co-authored-by: lai <[email protected]>
Co-authored-by: NeoLing <[email protected]>
Co-authored-by: EmilyMei <[email protected]>
Co-authored-by: 热心网友陈德华 <[email protected]>
Co-authored-by: chenguo <[email protected]>
Co-authored-by: ctenetlau <[email protected]>
Co-authored-by: liuwenping <[email protected]>
Co-authored-by: crayon <[email protected]>
Co-authored-by: liang ling <[email protected]>
Co-authored-by: tang202388 <[email protected]>
Co-authored-by: 进击的弗兰克 <[email protected]>
Co-authored-by: JayCC1 <[email protected]>
Co-authored-by: xlc <[email protected]>
Co-authored-by: ZC-A <[email protected]>
Co-authored-by: HACK-WU <[email protected]>
Co-authored-by: yzygyin <[email protected]>
Co-authored-by: Shamcle Ren <[email protected]>
Co-authored-by: 闪烁 <[email protected]>
Co-authored-by: 17 <[email protected]>
Co-authored-by: RyanYu <[email protected]>
  • Loading branch information
1 parent 2ce4b8c commit 444f80c
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 14 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -79,9 +79,13 @@ export default defineComponent({
};
});

const debounceUpdateChartOptions = debounce((xFields, yFields, dimensions, type) => {
setChartOptions(xFields, yFields, dimensions, formatListData.value, type);
}, 300);
let updateTimer = null;
const debounceUpdateChartOptions = (xFields, yFields, dimensions, type) => {
updateTimer && clearTimeout(updateTimer);
updateTimer = setTimeout(() => {
setChartOptions(xFields, yFields, dimensions, formatListData.value, type);
});
};

watch(
() => props.chartCounter,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -341,8 +341,11 @@ export default ({ target, type }: { target: Ref<any>; type: string }) => {
if (!chartInstance) {
initChartInstance();
}
setDefaultOption(type);
updateChartOptions(xFields, yFields, dimensions, data, type);

if (chartInstance) {
setDefaultOption(type);
updateChartOptions(xFields, yFields, dimensions, data, type);
}
};

onMounted(() => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -90,12 +90,8 @@ export default defineComponent({
editorConfig.value.height = entry.target?.offsetHeight ?? 400;
});

const storeChartOptions = () => {
store.commit('updateIndexItem', { chart_params: chartParams.value.chart_params });
};

const requestId = 'graphAnalysis_searchSQL';
const handleQueryBtnClick = (updateStore = true) => {
const handleQueryBtnClick = () => {
const sql = editorInstance?.value?.getValue();

if (!sql || isRequesting.value) {
Expand Down Expand Up @@ -123,9 +119,6 @@ export default defineComponent({
return axios(params)
.then((resp: any) => {
if (resp.data.result) {
if (updateStore) {
storeChartOptions();
}
isRequesting.value = false;
emit('change', resp.data);
} else {
Expand Down Expand Up @@ -162,7 +155,6 @@ export default defineComponent({
editorInstance.value.focus();
if (storeResult) {
onValueChange(resp.data.sql);
storeChartOptions();
}
})
.finally(() => {
Expand Down

0 comments on commit 444f80c

Please sign in to comment.