This is an automated email from the ASF dual-hosted git repository.
mintsweet pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/incubator-devlake.git
The following commit(s) were added to refs/heads/main by this push:
new 79df6f2e5 fix: onboard initial status error (#8015)
79df6f2e5 is described below
commit 79df6f2e5aa150e9236d1d4fe44ed4653122ba8e
Author: 青湛 <[email protected]>
AuthorDate: Mon Sep 9 16:16:25 2024 +1200
fix: onboard initial status error (#8015)
---
config-ui/src/features/onboard/slice.ts | 17 +++++++++--------
1 file changed, 9 insertions(+), 8 deletions(-)
diff --git a/config-ui/src/features/onboard/slice.ts
b/config-ui/src/features/onboard/slice.ts
index 87d771eb6..11400f43d 100644
--- a/config-ui/src/features/onboard/slice.ts
+++ b/config-ui/src/features/onboard/slice.ts
@@ -39,7 +39,13 @@ type DataType = {
export const request = createAsyncThunk('onboard/request', async () => {
const res = await API.store.get('onboard');
- return res;
+ return {
+ ...res,
+ initial: res ? true : res?.initial ?? false,
+ step: res?.step ?? 0,
+ records: res?.records ?? [],
+ done: res?.done ?? false,
+ };
});
export const update = createAsyncThunk('onboard/update', async (payload:
Partial<DataType>, { getState }) => {
@@ -47,6 +53,7 @@ export const update = createAsyncThunk('onboard/update',
async (payload: Partial
const res = await API.store.set('onboard', {
...data,
...payload,
+ initial: true,
step: payload.step ?? data.step + 1,
});
return res;
@@ -97,13 +104,7 @@ export const onboardSlice = createSlice({
})
.addCase(request.fulfilled, (state, action) => {
state.status = 'success';
- state.data = {
- ...action.payload,
- initial: action.payload?.initial ?? false,
- step: action.payload?.step ?? 0,
- records: action.payload?.records ?? [],
- done: action.payload?.done ?? false,
- };
+ state.data = action.payload;
})
.addCase(request.rejected, (state, action) => {
state.status = 'failed';