fix: data is not updated when appends are changed (#1872)

This commit is contained in:
Dunqing 2023-05-17 11:38:42 +08:00 committed by GitHub
parent 3603b2fe23
commit fdca52ae60
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -118,6 +118,9 @@ export const useResourceAction = (props, opts = {}) => {
return Promise.resolve({}); return Promise.resolve({});
} }
const actionParams = { ...params, ...opts }; const actionParams = { ...params, ...opts };
if (params?.appends) {
actionParams.appends = params.appends;
}
return resource[action](actionParams).then((res) => res.data); return resource[action](actionParams).then((res) => res.data);
}, },
{ {
@ -129,7 +132,7 @@ export const useResourceAction = (props, opts = {}) => {
} }
}, },
defaultParams: [params], defaultParams: [params],
refreshDeps: [runWhenParamsChanged ? JSON.stringify(params.appends) : null], refreshDeps: [runWhenParamsChanged ? null : JSON.stringify(params.appends)],
}, },
); );