perf: streamline billing panel bootstrap
Remove the redundant billing account read, cache packages for one minute, prefetch the billing chunk, and parallelize independent package reads. Co-Authored-By: Claude Code <noreply@anthropic.com>
This commit is contained in:
@@ -21,6 +21,8 @@ import type { Ref } from "react";
|
||||
import { AppLink } from "@/components/app-link";
|
||||
import { newChatHref, persistLoginSessionReturn, sessionHref } from "@/lib/chat-session-url";
|
||||
import { prefetchSecondaryPage } from "@/lib/secondary-page-data";
|
||||
import { prefetchBillingPanel } from "@/lib/billing-panel-loader";
|
||||
import { prefetchPaymentPackages } from "@/lib/payment-packages-cache";
|
||||
import {
|
||||
Sidebar,
|
||||
SidebarContent,
|
||||
@@ -368,7 +370,12 @@ export function AppSidebar({
|
||||
<Menu.Item className="account-menu-item" onClick={onOpenGeneral}>
|
||||
<Settings aria-hidden="true" /><span>通用设置</span><ChevronRight aria-hidden="true" />
|
||||
</Menu.Item>
|
||||
<Menu.Item className="account-menu-item" onClick={onOpenBilling}>
|
||||
<Menu.Item
|
||||
className="account-menu-item"
|
||||
onPointerEnter={() => { prefetchBillingPanel(); prefetchPaymentPackages(); }}
|
||||
onPointerDown={() => { prefetchBillingPanel(); prefetchPaymentPackages(); }}
|
||||
onClick={onOpenBilling}
|
||||
>
|
||||
<WalletCards aria-hidden="true" /><span>账户与点数</span><small>{account.credits} 点</small>
|
||||
</Menu.Item>
|
||||
<Menu.Separator className="account-menu-separator" />
|
||||
|
||||
Reference in New Issue
Block a user