@@ -1172,6 +1172,55 @@ public void InteractiveServerRootComponent_CanAccessCircuitContext()
1172
1172
Browser . Equal ( "True" , ( ) => Browser . FindElement ( By . Id ( "has-circuit-context" ) ) . Text ) ;
1173
1173
}
1174
1174
1175
+ [ Fact ]
1176
+ public void InteractiveServerRootComponents_CanBecomeInteractive_WithoutInterferingWithOtherCircuits ( )
1177
+ {
1178
+ // Start by setting up 2 tabs with interactive server components.
1179
+ SetUpPageWithOneInteractiveServerComponent ( ) ;
1180
+
1181
+ var firstWindow = Browser . CurrentWindowHandle ;
1182
+ Browser . SwitchTo ( ) . NewWindow ( WindowType . Tab ) ;
1183
+ var secondWindow = Browser . CurrentWindowHandle ;
1184
+
1185
+ SetUpPageWithOneInteractiveServerComponent ( ) ;
1186
+
1187
+ // Start streaming in the second tab.
1188
+ Browser . Click ( By . Id ( "start-streaming-link" ) ) ;
1189
+ Browser . Equal ( "Streaming" , ( ) => Browser . FindElement ( By . Id ( "status" ) ) . Text ) ;
1190
+
1191
+ // Add an interactive server component while streaming.
1192
+ // This will update the existing component, but the new component
1193
+ // won't become interactive until streaming ends.
1194
+ Browser . Click ( By . Id ( AddServerPrerenderedId ) ) ;
1195
+ Browser . Equal ( "False" , ( ) => Browser . FindElement ( By . Id ( $ "is-interactive-1") ) . Text ) ;
1196
+
1197
+ // Add an interactive server component in the first tab.
1198
+ // This component will become interactive immediately because the response
1199
+ // that rendered the component will have completed quickly.
1200
+ Browser . SwitchTo ( ) . Window ( firstWindow ) ;
1201
+ Browser . Click ( By . Id ( AddServerPrerenderedId ) ) ;
1202
+ Browser . Equal ( "True" , ( ) => Browser . FindElement ( By . Id ( $ "is-interactive-1") ) . Text ) ;
1203
+
1204
+ // Stop streaming in the second tab.
1205
+ // This will activate the pending component for interactivity.
1206
+ // This check verifies that a circuit can activate components from its most
1207
+ // recent response, even if that response isn't the most recent between all
1208
+ // circuits.
1209
+ Browser . SwitchTo ( ) . Window ( secondWindow ) ;
1210
+ Browser . Click ( By . Id ( "stop-streaming-link" ) ) ;
1211
+ Browser . Equal ( "True" , ( ) => Browser . FindElement ( By . Id ( $ "is-interactive-1") ) . Text ) ;
1212
+
1213
+ void SetUpPageWithOneInteractiveServerComponent ( )
1214
+ {
1215
+ Navigate ( $ "{ ServerPathBase } /streaming-interactivity") ;
1216
+
1217
+ Browser . Equal ( "Not streaming" , ( ) => Browser . FindElement ( By . Id ( "status" ) ) . Text ) ;
1218
+
1219
+ Browser . Click ( By . Id ( AddServerPrerenderedId ) ) ;
1220
+ Browser . Equal ( "True" , ( ) => Browser . FindElement ( By . Id ( $ "is-interactive-0") ) . Text ) ;
1221
+ }
1222
+ }
1223
+
1175
1224
private void BlockWebAssemblyResourceLoad ( )
1176
1225
{
1177
1226
// Force a WebAssembly resource cache miss so that we can fall back to using server interactivity
0 commit comments