airbnb / hypernova

A service for server-side rendering your JavaScript views

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

fallback in case of hypernova server didn't respond

k4mr4n opened this issue · comments

Hey all

<div id="root">{{ html }}</div>

If hypernova server fails by any reason and the html content would be empty, then the renderReact('Component', Component) wouldn't work either returns blank page and I have to call:

ReactDOM.hydrate(
    <Component />,
    document.getElementById('root')
  )

In this case how could I know my root is empty? because this condition throws error due to undefined document object:
document.getElementById('root') !== null && document.getElementById('root').hasChildNodes()

TypeError: ((!(null === document.getElementById(...))) && document.getElementById(...).hasChildNodes(...)) is not a function