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 473a5ff
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() ? '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 473a5ff

Please sign in to comment.