Second question, I think you're building your stat...
# prisma-whats-new
s
Second question, I think you're building your static site with some static pages deployed on Netlify or similar, right? But on first load there's always a "flash" as the style gets asynchronously applied and which doesn't look really nice. Are you planning to fix that, and if yes would you mind sharing how? I'm thinking of how I should now build my own site as well.
n
@sdubois that's basically what @tim has been looking into the last few days, maybe he can share some insights with you?
👍 1
s
Thanks that would be great yes. I've been considering if I should just do everything with Next.js but am interested to hear your pros and cons. Also if you really think Netlify is superior over Zeit's Now. (NB: Next.js is about to have a static export feature, which might help.)
n
@tim2 I guess it is 😄
t
@sdubois that is a very interesting topic! Do you mean the flash where the whole page is white for a short amount of time? So the point is that we prerender stuff with prep.js on build time (as we have a static site we can do that). Then we use webpack code splitting. When now the prerendered page is opened, ReactDOM.render() is called, but the async chunks for all visible components are not yet resolved. So we first need to wait until that is the case. This tool solves that problem: https://github.com/ctrlplusb/react-async-component Although it assumes that the prerendering happens on the server and not the client (prep uses electronjs) it needs some minor adjustments. After those async chunks are resolved you also may want to wait for apollo to finish its business before ReactDOM.render() is called. That is what
{getDataFromTree} from ‘react-apollo’
does. So these are the two things that you need to handle when you have code splitting and prerendering which you then host on netlify or surge. So next.js seems to me an easier solution. But on the other hand I only built small apps with next.js yet, whereas our homepage & docs project already is pretty big and complex. I already heard from people that big complex projects get pretty slow with next. If you’re interested in more details, I would be happy to jump on a skype call with you!
👍 1
s
Thanks for the explanations. Was this "slow next" observed with 2.0 or earlier? Sure feel free to reach me in DM if you wanna chat
I used Next.js in a starter project (https://github.com/relatenow/relate) when it was still in beta, haven't actively developed with it in past weeks. Will check again 🙂
👍 1