Restuta / rcn.io

:bicyclist: Making bike racing in USA "a better place" or "great again"
https://rcn.io
MIT License
44 stars 18 forks source link

Upgrade to React 16 + Streaming SSR #308

Open Restuta opened 6 years ago

Restuta commented 6 years ago

Few things broke as part of this upgrade.

1) opening a modal in a calendar and then reloading the page leads to inconsistent UI 2) React 16 doesn't patch SSR HTML, so when we "guess" a viewport size on the server and render guessed version it stays the same on the client. We need to patch this up with something like https://github.com/facebook/react/issues/8017#issuecomment-256351955

see also this suggestion https://github.com/facebook/react/issues/10591#issuecomment-327254514

TL;DR this means 1) we need to either get rid of this state and just show "normal" event page if page is refreshed, now when we have a "back to calendar" button this should be fine or we just need to render calendar on the client with a delay, e.g. twitter does this and trello 2) to fix this we would need to force re-render of the calendar, there is no other way around this since viewport size is unknown on the server

Restuta commented 6 years ago

It would be nice to start using React Helmet, but it doesn't support streaming yet :( https://github.com/nfl/react-helmet/issues/322

UPDATE:

This lib does https://github.com/staylor/react-helmet-async (https://spectrum.chat/thread/056d029c-99cc-4a54-889c-986497bc5646)