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 29d31d4
Showing 1 changed file with 4 additions and 2 deletions.
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() ? 'render' : 'hydrate';
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 29d31d4

Please sign in to comment.