@@ -59,7 +59,6 @@ import {
5959import { WorkspacePageContainer } from "../WorkspacePageContainer" ;
6060import { WorkspacePageHeader } from "../WorkspacePageHeader" ;
6161import { UsageLimitsSection } from "./UsageLimits" ;
62- import { makeLimitsFixture } from "./usageLimitsFixture" ;
6362import { UsagePriceOverrides } from "./UsagePriceOverrides" ;
6463import { UsageProviderChart , type UsageChartMetric } from "./UsageProviderChart" ;
6564import { PROVIDER_ORDER , PROVIDER_PRESENTATION , providersWithUsage } from "./usageProviders" ;
@@ -110,33 +109,10 @@ export function UsagePage() {
110109 useState < ReadonlySet < EnvironmentId > | null > ( null ) ;
111110 const { days : windowDays , window } = windowSelection ;
112111 const isPast24Hours = windowDays === 1 ;
113- const usage = useUsage ( window , selectedEnvironmentIds ) ;
114- // Dev only: `/usage?limitsFixture=<name>` lists synthetic environments in the
115- // picker and feeds the Limits view from them, so merge rules can be eyeballed.
116- const [ fixture ] = useState ( ( ) => {
117- if ( ! import . meta. env . DEV ) return null ;
118- const name = new URLSearchParams ( globalThis . location . search ) . get ( "limitsFixture" ) ;
119- return name ? makeLimitsFixture ( name , Date . now ( ) ) : null ;
120- } ) ;
121- const { merged, environments, selectedEnvironments, isPending, isPartial, refresh } =
122- useMemo ( ( ) => {
123- if ( ! fixture || ! showingLimits ) return usage ;
124- const all = [ ...fixture ] . map ( ( [ environmentId , presentation ] ) => ( {
125- environmentId,
126- label : presentation . entry . target . label ,
127- isPending : false ,
128- error : null ,
129- summary : null ,
130- } ) ) ;
131- return {
132- ...usage ,
133- environments : all ,
134- selectedEnvironments :
135- selectedEnvironmentIds === null
136- ? all
137- : all . filter ( ( environment ) => selectedEnvironmentIds . has ( environment . environmentId ) ) ,
138- } ;
139- } , [ fixture , selectedEnvironmentIds , showingLimits , usage ] ) ;
112+ const { merged, environments, selectedEnvironments, isPending, isPartial, refresh } = useUsage (
113+ window ,
114+ selectedEnvironmentIds ,
115+ ) ;
140116 const presentations = useAtomValue ( environmentPresentations . presentationsAtom ) ;
141117 const refreshProviders = useAtomCommand ( serverEnvironment . refreshProviders , {
142118 reportFailure : false ,
@@ -190,8 +166,6 @@ export function UsagePage() {
190166 if ( refreshingRef . current ) return ;
191167
192168 if ( showingLimits ) {
193- // Synthetic data has nothing to re-read.
194- if ( fixture ) return ;
195169 refreshingRef . current = true ;
196170 setIsRefreshing ( true ) ;
197171 void Promise . all (
@@ -375,10 +349,7 @@ export function UsagePage() {
375349 : `Select an environment to see ${ showingLimits ? "limits" : "usage" } .` }
376350 </ p >
377351 ) : showingLimits ? (
378- < UsageLimitsSection
379- selectedEnvironmentIds = { selectedEnvironmentIds }
380- fixture = { fixture }
381- />
352+ < UsageLimitsSection selectedEnvironmentIds = { selectedEnvironmentIds } />
382353 ) : isPending ? (
383354 < UsageSkeleton />
384355 ) : (
0 commit comments