MCPcopy Index your code
hub / github.com/codeaashu/claude-code / StatsContent

Function StatsContent

src/components/Stats.tsx:121–311  ·  view source on GitHub ↗

* Inner component that uses React 19's use() to read the stats promise. * Suspends while loading all-time stats, then handles date range changes without suspending.

(t0)

Source from the content-addressed store, hash-verified

119 * Suspends while loading all-time stats, then handles date range changes without suspending.
120 */
121function StatsContent(t0) {
122 const $ = _c(34);
123 const {
124 allTimePromise,
125 onClose
126 } = t0;
127 const allTimeResult = use(allTimePromise);
128 const [dateRange, setDateRange] = useState("all");
129 let t1;
130 if ($[0] === Symbol.for("react.memo_cache_sentinel")) {
131 t1 = {};
132 $[0] = t1;
133 } else {
134 t1 = $[0];
135 }
136 const [statsCache, setStatsCache] = useState(t1);
137 const [isLoadingFiltered, setIsLoadingFiltered] = useState(false);
138 const [activeTab, setActiveTab] = useState("Overview");
139 const [copyStatus, setCopyStatus] = useState(null);
140 let t2;
141 let t3;
142 if ($[1] !== dateRange || $[2] !== statsCache) {
143 t2 = () => {
144 if (dateRange === "all") {
145 return;
146 }
147 if (statsCache[dateRange]) {
148 return;
149 }
150 let cancelled = false;
151 setIsLoadingFiltered(true);
152 aggregateClaudeCodeStatsForRange(dateRange).then(data => {
153 if (!cancelled) {
154 setStatsCache(prev => ({
155 ...prev,
156 [dateRange]: data
157 }));
158 setIsLoadingFiltered(false);
159 }
160 }).catch(() => {
161 if (!cancelled) {
162 setIsLoadingFiltered(false);
163 }
164 });
165 return () => {
166 cancelled = true;
167 };
168 };
169 t3 = [dateRange, statsCache];
170 $[1] = dateRange;
171 $[2] = statsCache;
172 $[3] = t2;
173 $[4] = t3;
174 } else {
175 t2 = $[3];
176 t3 = $[4];
177 }
178 useEffect(t2, t3);

Callers

nothing calls this directly

Calls 5

useKeybindingFunction · 0.85
getNextDateRangeFunction · 0.85
handleScreenshotFunction · 0.85
useInputFunction · 0.85

Tested by

no test coverage detected