修复泥点余额明细刷新

钱包明细每次展开并在实时余额变化时读取最新拆分。

图片画板生成扣费或退款后同步刷新总额与充值中心。

充值中心读取增加 latest-wins 门禁并阻止旧响应覆盖权威结果。

补充钱包刷新、画板入口和充值乱序回归测试。

同步更新泥点统一资产入口决策记录。
This commit is contained in:
2026-07-20 12:48:28 +08:00
parent 0c04bbbea3
commit f1f2332e61
7 changed files with 220 additions and 27 deletions
@@ -522,6 +522,10 @@ export function ImageCanvasEditorView({
requestLogin: () => authUiRef.current?.openLoginModal(),
currentUser: authUi?.user ?? null,
});
const refreshEditorWalletState = useCallback(() => {
refreshEditorWalletBalance();
loadRechargeCenter();
}, [loadRechargeCenter, refreshEditorWalletBalance]);
const isAccountPaymentModalOpen =
isRewardCodeOpen ||
isRechargeOpen ||
@@ -1239,7 +1243,7 @@ export function ImageCanvasEditorView({
assetFolderId: activeUploadFolderId,
upsertGeneratedAsset,
applyProjectSnapshot: applyGeneratedProjectSnapshot,
onWalletBalanceMayHaveChanged: refreshEditorWalletBalance,
onWalletBalanceMayHaveChanged: refreshEditorWalletState,
});
const handleEditorAgentConfirmSent = useCallback(() => {
generationSurface.refreshTaskList();
@@ -1258,7 +1262,7 @@ export function ImageCanvasEditorView({
if (warning) {
showGenerationWarning(warning);
}
refreshEditorWalletBalance();
refreshEditorWalletState();
void loadEditorProject(projectId)
.then(applyGeneratedProjectSnapshot)
.catch(() => undefined);
@@ -1266,7 +1270,7 @@ export function ImageCanvasEditorView({
[
applyGeneratedProjectSnapshot,
projectId,
refreshEditorWalletBalance,
refreshEditorWalletState,
showGenerationWarning,
],
);
@@ -120,7 +120,7 @@ describe('ImageCanvasTopbarView', () => {
await user.click(screen.getByRole('button', { name: '充值' }));
expect(props.onRecharge).toHaveBeenCalledTimes(1);
expect(props.onRequestWalletDetails).not.toHaveBeenCalled();
expect(props.onRequestWalletDetails).toHaveBeenCalledTimes(1);
});
it('shows the current user avatar beside the mud point balance', () => {