File tree 1 file changed +47
-0
lines changed
packages/react-server-dom-webpack/src/__tests__ 1 file changed +47
-0
lines changed Original file line number Diff line number Diff line change @@ -525,6 +525,53 @@ describe('ReactFlightDOMBrowser', () => {
525
525
expect ( container . innerHTML ) . toBe ( '{"foo":1}{"foo":1}' ) ;
526
526
} ) ;
527
527
528
+ it ( 'should handle deduped props of elements in fragments' , async ( ) => {
529
+ let resolveFooClientComponentChunk ;
530
+
531
+ const FooClient = clientExports (
532
+ function Foo ( { children, item} ) {
533
+ return children ;
534
+ } ,
535
+ '1' ,
536
+ '/foo.js' ,
537
+ new Promise ( resolve => ( resolveFooClientComponentChunk = resolve ) ) ,
538
+ ) ;
539
+
540
+ const shared = < div /> ;
541
+
542
+ function Server ( ) {
543
+ return (
544
+ < FooClient track = { shared } >
545
+ < React . Fragment > { shared } </ React . Fragment >
546
+ </ FooClient >
547
+ ) ;
548
+ }
549
+
550
+ const stream = await serverAct ( ( ) =>
551
+ ReactServerDOMServer . renderToReadableStream ( < Server /> , webpackMap ) ,
552
+ ) ;
553
+
554
+ function ClientRoot ( { response} ) {
555
+ return use ( response ) ;
556
+ }
557
+
558
+ const response = ReactServerDOMClient . createFromReadableStream ( stream ) ;
559
+ const container = document . createElement ( 'div' ) ;
560
+ const root = ReactDOMClient . createRoot ( container ) ;
561
+
562
+ await act ( ( ) => {
563
+ root . render ( < ClientRoot response = { response } /> ) ;
564
+ } ) ;
565
+
566
+ expect ( container . innerHTML ) . toBe ( '' ) ;
567
+
568
+ await act ( ( ) => {
569
+ resolveFooClientComponentChunk ( ) ;
570
+ } ) ;
571
+
572
+ expect ( container . innerHTML ) . toBe ( '<div></div>' ) ;
573
+ } ) ;
574
+
528
575
it ( 'should progressively reveal server components' , async ( ) => {
529
576
let reportedErrors = [ ] ;
530
577
You can’t perform that action at this time.
0 commit comments