@@ -332,22 +332,18 @@ describe('useObservable', () => {
332332 } ) ;
333333
334334 describe ( 'Server rendering' , ( ) => {
335- // Renders `status` and `data` so the assertions read the snapshot React actually used,
336- // rather than a value the test computed for itself.
335+ // Renders `status` and `data` so assertions read the snapshot React actually used.
337336 const Probe = ( { observableId, observable$, config } : { observableId : string ; observable$ : Subject < any > ; config ?: ReactFireOptions } ) => {
338337 const { status, data } = useObservable ( observableId , observable$ , { suspense : false , ...config } ) ;
339- // A single interpolated child, because adjacent JSX text nodes render with `<!-- -->`
340- // separators between them and the assertions below match on the plain string.
338+ // One interpolated child: adjacent JSX text nodes render with `<!-- -->` between them.
341339 return < div > { `${ status } :${ String ( data ) } ` } </ div > ;
342340 } ;
343341
344342 it ( 'renders on the server instead of throwing' , ( ) => {
345343 const observable$ : Subject < any > = new Subject ( ) ;
346344
347- // Without a getServerSnapshot, React throws "Missing getServerSnapshot, which is
348- // required for server-rendered content" and the whole subtree falls back to client
349- // rendering. This is the #748 regression test: delete the third argument to
350- // useSyncExternalStore and this assertion fails.
345+ // The #748 regression test: delete the third argument to useSyncExternalStore and
346+ // this fails with "Missing getServerSnapshot".
351347 expect ( ( ) => renderToString ( < Probe observableId = "ssr-renders" observable$ = { observable$ } /> ) ) . not . toThrow ( ) ;
352348 } ) ;
353349
@@ -368,10 +364,8 @@ describe('useObservable', () => {
368364 } ) ;
369365
370366 it ( 'does not leak a cached value from another request into the server snapshot' , async ( ) => {
371- // `preloadedObservables` lives on `globalThis` and is keyed only by observableId, so on
372- // a server every concurrent request shares it. A getServerSnapshot that read
373- // `observable.immutableStatus` would render whatever the previous request left behind.
374- // Here the first render stands in for that earlier request.
367+ // `preloadedObservables` is on `globalThis`, keyed only by observableId, so concurrent
368+ // server requests share it. The first render below stands in for an earlier request.
375369 const observable$ : Subject < any > = new Subject ( ) ;
376370 const observableId = 'ssr-no-cross-request-leak' ;
377371
@@ -386,10 +380,8 @@ describe('useObservable', () => {
386380 } ) ;
387381
388382 it ( 'prefers the callers initialData over a value already in the shared cache' , async ( ) => {
389- // The branch above that reads `initialData` is only reachable when the cache ALREADY
390- // holds a value for this id: otherwise the overlay in `useObservable` sets status,
391- // data and hasEmitted itself and the server snapshot never decides anything. So seed
392- // the cache first, exactly as the leak test does, and only then pass `initialData`.
383+ // The `initialData` branch is only reachable when the cache already holds a value for
384+ // this id; otherwise `useObservable`'s overlay decides and the snapshot never does.
393385 const observable$ : Subject < any > = new Subject ( ) ;
394386 const observableId = 'ssr-initial-data-beats-cache' ;
395387
0 commit comments