归一化钱包快照与充值中心交互

绑定 snapshot 至 owner lifecycle。
This commit is contained in:
2026-08-06 12:04:19 +08:00
parent 75130c8edf
commit c8e89cef02
@@ -198,7 +198,7 @@ export function useAccountWallet(currentUserId: string) {
return;
}
const rechargeLifecycle = rechargeLifecycleRef.current;
const snapshotOwnerUserId = currentUserId;
const walletSnapshot = captureWalletBalanceSnapshot(currentUserId);
setSubmittingRechargeProductId(product.productId);
setRechargeError(null);
try {
@@ -208,7 +208,7 @@ export function useAccountWallet(currentUserId: string) {
if (rechargeLifecycleRef.current !== rechargeLifecycle) {
return;
}
applyRechargeContent(snapshotOwnerUserId, response.center);
applyRechargeContent(walletSnapshot, response.center);
const nativePayment = response.wechatNativePayment;
const codeUrl = nativePayment?.codeUrl?.trim();
const expiresAt = nativePayment?.expiresAt?.trim();
@@ -239,7 +239,7 @@ export function useAccountWallet(currentUserId: string) {
return;
}
const rechargeLifecycle = rechargeLifecycleRef.current;
const snapshotOwnerUserId = currentUserId;
const walletSnapshot = captureWalletBalanceSnapshot(currentUserId);
const orderId = nativeRechargePayment.orderId;
setNativeRechargePayment((current) =>
current?.orderId === orderId
@@ -251,7 +251,7 @@ export function useAccountWallet(currentUserId: string) {
if (rechargeLifecycleRef.current !== rechargeLifecycle) {
return;
}
applyRechargeContent(snapshotOwnerUserId, response.center);
applyRechargeContent(walletSnapshot, response.center);
if (response.order.status === 'paid') {
setNativeRechargePayment(null);
void onWalletBalanceMayHaveChanged();