Skip to content

Commit

Permalink
[FEATURE] Added hydrate support for advanced Rendertron Setup
Browse files Browse the repository at this point in the history
 related pull request: GoogleChrome/rendertron#654
  • Loading branch information
lewisvoncken committed Apr 9, 2021
1 parent 9d5e9e9 commit e388b5d
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 3 deletions.
3 changes: 2 additions & 1 deletion packages/upward-js/lib/createUpwardServer.js
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,8 @@ async function createUpwardServer({
excludeUrlPattern: new RegExp(
env.RENDERTRON_EXCLUDE_URL_PATTERN,
'i'
)
),
timeout: 500
})
);
}
Expand Down
6 changes: 4 additions & 2 deletions packages/venia-concept/src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -112,13 +112,15 @@ const apolloLink = ApolloLink.from([
Adapter.apolloLink(apiBase)
]);

ReactDOM.render(
const rootElement = document.getElementById('root');
const renderMethod = rootElement.hasChildNodes() ? 'hydrate' : 'render';
ReactDOM[renderMethod](
<Adapter apiBase={apiBase} apollo={{ link: apolloLink }} store={store}>
<AppContextProvider>
<App />
</AppContextProvider>
</Adapter>,
document.getElementById('root')
rootElement
);

registerSW();
Expand Down

0 comments on commit e388b5d

Please sign in to comment.