@@ -216,6 +216,25 @@ function shouldReleaseSlot(current: FreebuffSessionResponse | null): boolean {
216216 )
217217}
218218
219+ function toLandingSession (
220+ current : FreebuffSessionResponse | null ,
221+ ) : Extract < FreebuffSessionResponse , { status : 'none' } > {
222+ const accessTier =
223+ current && 'accessTier' in current ? current . accessTier : undefined
224+ const queueDepthByModel =
225+ current && 'queueDepthByModel' in current
226+ ? current . queueDepthByModel
227+ : undefined
228+ const rateLimitsByModel = getRateLimitsByModel ( current )
229+
230+ return {
231+ status : 'none' ,
232+ ...( accessTier ? { accessTier } : { } ) ,
233+ ...( queueDepthByModel ? { queueDepthByModel } : { } ) ,
234+ ...( rateLimitsByModel ? { rateLimitsByModel } : { } ) ,
235+ }
236+ }
237+
219238/** Best-effort DELETE of the caller's session row, gated on actually holding
220239 * one. Used both by exit paths and any flow that wants the next POST to
221240 * start clean (rejoin, return-to-landing). Always swallows errors — the
@@ -588,7 +607,10 @@ export function useFreebuffSession(): UseFreebuffSessionResult {
588607 // picker metadata from the response, ignoring whatever status it
589608 // claims. Polling resumes when the user commits to a model via
590609 // joinFreebuffQueue.
591- apply ( { status : 'none' } )
610+ const landingSession = toLandingSession (
611+ useFreebuffSessionStore . getState ( ) . session ,
612+ )
613+ apply ( landingSession )
592614 const fetchController = abortController
593615 callSession ( 'GET' , token , { signal : fetchController . signal } )
594616 . then ( ( response ) => {
@@ -602,9 +624,14 @@ export function useFreebuffSession(): UseFreebuffSessionResult {
602624 if ( response . status === 'none' || response . status === 'queued' ) {
603625 apply ( {
604626 status : 'none' ,
605- accessTier : response . accessTier ,
606- queueDepthByModel : response . queueDepthByModel ,
607- rateLimitsByModel : response . rateLimitsByModel ,
627+ accessTier :
628+ response . accessTier ?? landingSession . accessTier ,
629+ queueDepthByModel :
630+ response . queueDepthByModel ??
631+ landingSession . queueDepthByModel ,
632+ rateLimitsByModel :
633+ response . rateLimitsByModel ??
634+ landingSession . rateLimitsByModel ,
608635 } )
609636 }
610637 } )
0 commit comments