Skip to content

Commit 4edfbce

Browse files
committed
fix: Delete async await
Change updateFilterAndFetchDataset function Delete the try catch in the outer layer of request2
1 parent 1dc7ffd commit 4edfbce

File tree

6 files changed

+19
-27
lines changed

6 files changed

+19
-27
lines changed

frontend/src/app/components/ChartEditor.tsx

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -296,7 +296,7 @@ export const ChartEditor: FC<ChartEditorProps> = ({
296296
chartConfig?.datas,
297297
drillOptionRef.current,
298298
);
299-
}, [dispatch, chart?.meta?.id, registerChartEvents]);
299+
}, [dispatch, chart?.meta?.id, registerChartEvents, chartConfig?.datas]);
300300

301301
const handleChartChange = (c: IChart) => {
302302
registerChartEvents(c);
@@ -327,7 +327,7 @@ export const ChartEditor: FC<ChartEditorProps> = ({
327327
};
328328

329329
const handleChartConfigChange = useCallback(
330-
async (type, payload) => {
330+
(type, payload) => {
331331
if (expensiveQuery) {
332332
dispatch(
333333
workbenchSlice.actions.updateChartConfig({
@@ -357,7 +357,7 @@ export const ChartEditor: FC<ChartEditorProps> = ({
357357
});
358358
}
359359

360-
await dispatch(
360+
dispatch(
361361
workbenchSlice.actions.updateCurrentDataViewComputedFields(
362362
computedFields,
363363
),

frontend/src/app/pages/ChartWorkbenchPage/components/ChartOperationPanel/components/ChartDataViewPanel/ChartDataViewPanel.tsx

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -67,12 +67,6 @@ const ChartDataViewPanel: FC<{
6767
const [isDisplayAddNewModal, setIsDisplayAddNewModal] = useToggle();
6868
const views = useSelector(dataviewsSelector);
6969

70-
useMount(() => {
71-
if (defaultViewId) {
72-
handleDataViewChange(defaultViewId);
73-
}
74-
});
75-
7670
const path = useMemo(() => {
7771
return views?.length && dataView
7872
? getPath(

frontend/src/app/pages/MainPage/pages/ViewPage/slice/thunks.ts

Lines changed: 7 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -332,17 +332,13 @@ export const deleteView = createAsyncThunk<
332332
DeleteViewParams,
333333
{ state: RootState }
334334
>('view/deleteView', async ({ id, archive, resolve }, { dispatch }) => {
335-
try {
336-
await request2<boolean>({
337-
url: `/views/${id}`,
338-
method: 'DELETE',
339-
params: { archive },
340-
});
341-
resolve();
342-
return null;
343-
} catch (error) {
344-
throw error;
345-
}
335+
await request2<boolean>({
336+
url: `/views/${id}`,
337+
method: 'DELETE',
338+
params: { archive },
339+
});
340+
resolve();
341+
return null;
346342
});
347343

348344
export const getEditorProvideCompletionItems = createAsyncThunk<

frontend/src/app/pages/MainPage/pages/VizPage/ChartPreview/ChartPreview.tsx

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -389,7 +389,7 @@ const ChartPreviewBoard: FC<{
389389
);
390390
};
391391

392-
const handleChartDrillDataAggregationChange = async (type, payload) => {
392+
const handleChartDrillDataAggregationChange = (type, payload) => {
393393
const rows = getInterimDateAggregateRows(payload.value?.rows);
394394
const dateAggregationField = rows.filter(
395395
v => v.category === ChartDataViewFieldCategory.DateAggregationField,
@@ -402,13 +402,13 @@ const ChartPreviewBoard: FC<{
402402
chartPreview?.chartConfig,
403403
);
404404

405-
await dispatch(
405+
dispatch(
406406
vizAction.updateComputedFields({
407407
backendChartId,
408408
computedFields,
409409
}),
410410
);
411-
await dispatch(
411+
dispatch(
412412
updateGroupAndFetchDataset({
413413
backendChartId,
414414
payload: payload,

frontend/src/app/pages/MainPage/pages/VizPage/slice/thunks.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -326,7 +326,7 @@ export const updateFilterAndFetchDataset = createAsyncThunk(
326326
thunkAPI,
327327
) => {
328328
await thunkAPI.dispatch(
329-
vizActions.updateChartPreviewGroup({
329+
vizActions.updateChartPreviewFilter({
330330
backendChartId: arg.backendChartId,
331331
payload: arg.payload,
332332
}),

frontend/src/app/pages/SharePage/ChartForShare.tsx

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -151,7 +151,8 @@ const ChartForShare: FC<{
151151
}),
152152
);
153153
};
154-
const handleChartDrillDataAggregationChange = async (type, payload) => {
154+
155+
const handleChartDrillDataAggregationChange = (type, payload) => {
155156
const rows = getInterimDateAggregateRows(payload.value?.rows);
156157
const dateAggregationField = rows.filter(
157158
v => v.category === ChartDataViewFieldCategory.DateAggregationField,
@@ -164,20 +165,21 @@ const ChartForShare: FC<{
164165
chartPreview?.chartConfig,
165166
);
166167

167-
await dispatch(
168+
dispatch(
168169
shareActions.updateComputedFields({
169170
backendChartId: chartPreview?.backendChart?.id!,
170171
computedFields,
171172
}),
172173
);
173-
await dispatch(
174+
dispatch(
174175
updateGroupAndFetchDatasetForShare({
175176
backendChartId: chartPreview?.backendChart?.id!,
176177
payload: payload,
177178
drillOption: drillOptionRef?.current,
178179
}),
179180
);
180181
};
182+
181183
return (
182184
<StyledChartPreviewBoard>
183185
<div ref={controlRef}>

0 commit comments

Comments
 (0)