@@ -63,6 +63,7 @@ describe("threadRoutes", () => {
6363 expect (
6464 resolveThreadRouteRenderState ( {
6565 bootstrapComplete : isThreadRouteSnapshotAuthoritative ( status ) ,
66+ connectionPhase : "offline" ,
6667 serverThreadExists : source === "server thread" ,
6768 serverThreadDeleted : false ,
6869 unlistedThreadDetail : EMPTY_ENVIRONMENT_THREAD_STATE ,
@@ -76,6 +77,7 @@ describe("threadRoutes", () => {
7677 expect (
7778 resolveThreadRouteRenderState ( {
7879 bootstrapComplete : false ,
80+ connectionPhase : "connecting" ,
7981 serverThreadExists : false ,
8082 serverThreadDeleted : false ,
8183 unlistedThreadDetail : { ...EMPTY_ENVIRONMENT_THREAD_STATE , status : "deleted" } ,
@@ -85,6 +87,7 @@ describe("threadRoutes", () => {
8587 expect (
8688 resolveThreadRouteRenderState ( {
8789 bootstrapComplete : true ,
90+ connectionPhase : "connected" ,
8891 serverThreadExists : false ,
8992 serverThreadDeleted : false ,
9093 unlistedThreadDetail : { ...EMPTY_ENVIRONMENT_THREAD_STATE , status : "deleted" } ,
@@ -96,6 +99,7 @@ describe("threadRoutes", () => {
9699 it ( "opens an unlisted server thread once its detail arrives, without waiting for the shell" , ( ) => {
97100 const route = {
98101 bootstrapComplete : isThreadRouteSnapshotAuthoritative ( "live" ) ,
102+ connectionPhase : "connected" as const ,
99103 serverThreadExists : false ,
100104 serverThreadDeleted : false ,
101105 draftThreadExists : false ,
@@ -130,6 +134,13 @@ describe("threadRoutes", () => {
130134 ...EMPTY_ENVIRONMENT_THREAD_STATE ,
131135 error : Option . some ( "Connection interrupted" ) ,
132136 } ;
137+ expect (
138+ resolveThreadRouteRenderState ( {
139+ ...route ,
140+ connectionPhase : "connecting" ,
141+ unlistedThreadDetail : failedDetail ,
142+ } ) ,
143+ ) . toBe ( "loading" ) ;
133144 expect (
134145 resolveThreadRouteRenderState ( {
135146 ...route ,
@@ -155,11 +166,40 @@ describe("threadRoutes", () => {
155166 ) . toBe ( "ready" ) ;
156167 } ) ;
157168
169+ it . each ( [ "blocked" , "offline" , "backoff" , "available" ] as const ) (
170+ "offers recovery for an uncached thread while its connection is %s without a detail error" ,
171+ ( connectionPhase ) => {
172+ const route = {
173+ bootstrapComplete : false ,
174+ connectionPhase,
175+ serverThreadExists : false ,
176+ serverThreadDeleted : false ,
177+ draftThreadExists : false ,
178+ } ;
179+ expect (
180+ resolveThreadRouteRenderState ( {
181+ ...route ,
182+ unlistedThreadDetail : EMPTY_ENVIRONMENT_THREAD_STATE ,
183+ } ) ,
184+ ) . toBe ( "error" ) ;
185+ expect (
186+ resolveThreadRouteRenderState ( {
187+ ...route ,
188+ unlistedThreadDetail : {
189+ ...EMPTY_ENVIRONMENT_THREAD_STATE ,
190+ status : "synchronizing" ,
191+ } ,
192+ } ) ,
193+ ) . toBe ( "error" ) ;
194+ } ,
195+ ) ;
196+
158197 it . each ( [ "missing" , "deleted" , "archived" ] as const ) (
159198 "redirects an unlisted thread only after detail confirms it is %s" ,
160199 ( outcome ) => {
161200 const route = {
162201 bootstrapComplete : isThreadRouteSnapshotAuthoritative ( "live" ) ,
202+ connectionPhase : "connected" as const ,
163203 serverThreadExists : false ,
164204 serverThreadDeleted : false ,
165205 draftThreadExists : false ,
@@ -203,6 +243,7 @@ describe("threadRoutes", () => {
203243 expect (
204244 resolveThreadRouteRenderState ( {
205245 bootstrapComplete : isThreadRouteSnapshotAuthoritative ( "cached" ) ,
246+ connectionPhase : "offline" ,
206247 serverThreadExists : true ,
207248 serverThreadDeleted : true ,
208249 unlistedThreadDetail : EMPTY_ENVIRONMENT_THREAD_STATE ,
0 commit comments