3D 提交失败路径也刷新钱包余额
- src/components/image-editor/model3d-generation/useModel3dGenerationTask.ts:请求失败与「2xx 但没有任务状态」两条路径都调用 onWalletBalanceMayHaveChanged,与其它画布生成链路的 runEditorGenerationWithWalletRefresh 同一口径(超时或空 body 的 2xx 都可能已经扣费) - src/components/image-editor/model3d-generation/useModel3dGenerationTask.test.tsx:补两条失败路径各刷新一次钱包的断言
This commit is contained in:
@@ -127,6 +127,8 @@ export function useModel3dGenerationTask({
|
||||
if (!queueState) {
|
||||
// 2xx 但没有任务状态(空 body 或缺 status 的 payload)不能当成功静默复位:
|
||||
// 用户既看不到任务也没有任何提示,服务端细节被丢掉。
|
||||
// 服务端在这条路上也可能已经扣过费,钱包余额同样要按「可能变了」刷新。
|
||||
onWalletBalanceMayHaveChanged?.();
|
||||
updateCanvasGenerationDialogById(dialogId, (currentDialog) => ({
|
||||
...currentDialog,
|
||||
status: 'failed',
|
||||
@@ -155,6 +157,9 @@ export function useModel3dGenerationTask({
|
||||
errorMessage: undefined,
|
||||
}));
|
||||
} catch (error) {
|
||||
// 超时等失败也可能意味着服务端已经扣费(与其它生成链路的
|
||||
// runEditorGenerationWithWalletRefresh 同一口径),失败路径也要刷新钱包。
|
||||
onWalletBalanceMayHaveChanged?.();
|
||||
updateCanvasGenerationDialogById(dialogId, (currentDialog) => ({
|
||||
...currentDialog,
|
||||
status: 'failed',
|
||||
|
||||
Reference in New Issue
Block a user