修复钱包异步边界与任务陈旧状态

隔离账号切换后的充值响应并中止失效支付监听

防止乱序钱包快照回滚并保留旧版总额兜底

清理任务重试耗尽后的陈旧状态并补充回归测试

稳定测试夹具、用户错误提示与首帧加载状态

同步单一钱包 Store 的长期决策记录
This commit is contained in:
2026-08-07 11:00:04 +08:00
parent 58bf56ec56
commit 098009a701
12 changed files with 273 additions and 65 deletions
@@ -240,6 +240,9 @@ export function PlatformEntryFlowShellImpl({
const storedMudPointBalance = usePlatformWalletStore(
(state) => state.mudPointBalance,
);
const storedLegacyWalletBalance = usePlatformWalletStore(
(state) => state.legacyWalletBalance,
);
const storedMudPointBalanceStatus = usePlatformWalletStore(
(state) => state.mudPointBalanceStatus,
);
@@ -252,12 +255,14 @@ export function PlatformEntryFlowShellImpl({
const mudPointBalance = walletOwnerMatchesCurrentUser
? storedMudPointBalance
: null;
const mudPointBalanceStatus = walletOwnerMatchesCurrentUser
? storedMudPointBalanceStatus
: 'idle';
const mudPointBalanceError = walletOwnerMatchesCurrentUser
? storedMudPointBalanceError
: '';
const isWalletBalanceLoading =
Boolean(currentWalletOwnerUserId) &&
(!walletOwnerMatchesCurrentUser ||
storedMudPointBalanceStatus === 'idle' ||
storedMudPointBalanceStatus === 'loading');
const refreshDashboard = useCallback(async () => {
if (!authUi?.user || !authUi.canAccessProtectedData) {
@@ -288,7 +293,9 @@ export function PlatformEntryFlowShellImpl({
currentUser: authUi?.user,
});
const legacyWalletBalance = walletOwnerMatchesCurrentUser
? (profileCenter.rechargeCenter?.walletBalance ?? null)
? (storedLegacyWalletBalance ??
profileCenter.rechargeCenter?.walletBalance ??
null)
: null;
const openCreation = useCallback(() => {
@@ -489,7 +496,7 @@ export function PlatformEntryFlowShellImpl({
variant={isDesktopLayout ? 'desktop' : 'mobile'}
balance={balance}
breakdown={mudPointBalance}
isLoading={mudPointBalanceStatus === 'loading'}
isLoading={isWalletBalanceLoading}
error={mudPointBalanceError || null}
className={
isDesktopLayout
@@ -543,7 +550,7 @@ export function PlatformEntryFlowShellImpl({
<PlatformActiveProfileView
dashboard={dashboard}
isLoadingDashboard={isLoadingDashboard}
isLoadingWalletBalance={mudPointBalanceStatus === 'loading'}
isLoadingWalletBalance={isWalletBalanceLoading}
legacyWalletBalance={legacyWalletBalance}
mudPointBalance={mudPointBalance}
user={authUi?.user}