From dcc8d1a638723678b6aeb1da95fd29a30314d0c3 Mon Sep 17 00:00:00 2001 From: adamelmore <2363879+adamdottv@users.noreply.github.com> Date: Sun, 25 Jan 2026 06:42:33 -0600 Subject: perf(app): performance improvements --- .../app/src/components/session/session-context-tab.tsx | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) (limited to 'packages/app/src/components/session') diff --git a/packages/app/src/components/session/session-context-tab.tsx b/packages/app/src/components/session/session-context-tab.tsx index 4c672af3e..37733caff 100644 --- a/packages/app/src/components/session/session-context-tab.tsx +++ b/packages/app/src/components/session/session-context-tab.tsx @@ -26,6 +26,14 @@ export function SessionContextTab(props: SessionContextTabProps) { const sync = useSync() const language = useLanguage() + const usd = createMemo( + () => + new Intl.NumberFormat(language.locale(), { + style: "currency", + currency: "USD", + }), + ) + const ctx = createMemo(() => { const last = findLast(props.messages(), (x) => { if (x.role !== "assistant") return false @@ -62,12 +70,8 @@ export function SessionContextTab(props: SessionContextTabProps) { }) const cost = createMemo(() => { - const locale = language.locale() const total = props.messages().reduce((sum, x) => sum + (x.role === "assistant" ? x.cost : 0), 0) - return new Intl.NumberFormat(locale, { - style: "currency", - currency: "USD", - }).format(total) + return usd().format(total) }) const counts = createMemo(() => { -- cgit v1.2.3