File tree 1 file changed +9
-2
lines changed
1 file changed +9
-2
lines changed Original file line number Diff line number Diff line change 1
1
import { onPageLoad , ServerSink } from "meteor/server-render" ;
2
2
import * as React from 'react' ;
3
- import { renderToString , renderToNodeStream } from 'react-dom/server' ;
3
+ import { renderToString , renderToPipeableStream } from 'react-dom/server' ;
4
4
import { flushSync } from 'react-dom' ;
5
5
import { hydrateRoot } from 'react-dom/client' ;
6
6
import { ServerStyleSheet } from "styled-components" ;
7
+ import { PassThrough } from 'stream'
7
8
8
9
// Based on https://docs.meteor.com/packages/server-render.html
9
10
@@ -12,7 +13,13 @@ onPageLoad(sink => {
12
13
} ) ;
13
14
14
15
onPageLoad ( sink => {
15
- sink . renderIntoElementById ( "app" , renderToNodeStream ( < div > Hello World</ div > ) ) ;
16
+ const passthrough = new PassThrough ( ) ;
17
+ const { pipe} = renderToPipeableStream ( < div > Hello World</ div > , {
18
+ onShellReady ( ) {
19
+ pipe ( passthrough ) ;
20
+ }
21
+ } ) ;
22
+ sink . renderIntoElementById ( "app" , passthrough ) ;
16
23
} ) ;
17
24
18
25
onPageLoad ( async ( ) => {
You can’t perform that action at this time.
0 commit comments