fix(client): 修 pro 会员启动闪广告/统计闪 0 — 加载门覆盖 auth 加载窗口
ci-pangolin / Lint — shellcheck (push) Successful in 6s
ci-pangolin / OpenAPI Sync Check (push) Successful in 21s
ci-pangolin / Redline Scan — 脱敏 (UI 文案) (push) Successful in 7s
ci-pangolin / Flutter — analyze + test (push) Successful in 23s
ci-pangolin / Portable SQL — 可移植性 (mysql/sqlite) (push) Successful in 5s
ci-pangolin / Codegen Drift — token 生成物未漂移 (push) Successful in 5s
ci-pangolin / Go — build + test (push) Successful in 9s
ci-pangolin / E2E Smoke — L4 进程级端到端 (push) Successful in 18s
ci-pangolin / Go — integration (mysql/redis testcontainers) (push) Failing after 4m52s
ci-pangolin / Golden — 视觉回归 (components + auth) (push) Successful in 15s
ci-pangolin / Lint — shellcheck (push) Successful in 6s
ci-pangolin / OpenAPI Sync Check (push) Successful in 21s
ci-pangolin / Redline Scan — 脱敏 (UI 文案) (push) Successful in 7s
ci-pangolin / Flutter — analyze + test (push) Successful in 23s
ci-pangolin / Portable SQL — 可移植性 (mysql/sqlite) (push) Successful in 5s
ci-pangolin / Codegen Drift — token 生成物未漂移 (push) Successful in 5s
ci-pangolin / Go — build + test (push) Successful in 9s
ci-pangolin / E2E Smoke — L4 进程级端到端 (push) Successful in 18s
ci-pangolin / Go — integration (mysql/redis testcontainers) (push) Failing after 4m52s
ci-pangolin / Golden — 视觉回归 (components + auth) (push) Successful in 15s
之前 meLoadingProvider=isLoading&&!hasValue 漏了两段:启动时 auth 异步读 token 期间 isLoggedIn=false → me 同步返回免费默认(广告);token 到后 me 拉真实值时 hasValue 已是免费默认 → !hasValue 不成立、仍不转圈。改为: - meLoadingProvider:auth.isLoading 时转圈;未登录不转;已登录看 me.isLoading - 统计页 loading:auth.isLoading || usageProvider.isLoading 未登录(确定访客)/golden(settle 后)不转圈,golden 不受影响。 Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
@@ -7,6 +7,7 @@ import '../models/usage_point.dart';
|
||||
import '../pangolin_theme.dart';
|
||||
import '../state/account_providers.dart';
|
||||
import '../state/app_providers.dart';
|
||||
import '../state/auth_provider.dart';
|
||||
import '../widgets/app_top_bar.dart';
|
||||
import '../widgets/pangolin_icons.dart';
|
||||
import '../widgets/period_card.dart';
|
||||
@@ -22,8 +23,9 @@ class StatsPage extends ConsumerWidget {
|
||||
final t = ref.watch(appTextProvider);
|
||||
final usageAsync = ref.watch(usageProvider(30));
|
||||
final usage = usageAsync.valueOrNull ?? const <UsagePoint>[];
|
||||
// 加载中且无缓存 → 整页转圈(先拉数据再渲染,不闪默认 0)。
|
||||
final loading = usageAsync.isLoading && !usageAsync.hasValue;
|
||||
// 先拉数据再渲染(不闪默认 0):auth 还在读 token,或已登录但 usage 还在拉 → 整页转圈。
|
||||
// (auth 加载期 isLoggedIn=false → usage 会同步返回空,故必须并上 auth.isLoading。)
|
||||
final loading = ref.watch(authProvider).isLoading || usageAsync.isLoading;
|
||||
|
||||
// 周期聚合:取最后 N 天的点求和。最后一点即今日(避开 UTC/本地日期换算)。
|
||||
(int down, int up, int min) sumLast(int days) {
|
||||
|
||||
Reference in New Issue
Block a user