-
-
Notifications
You must be signed in to change notification settings - Fork 630
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Placeholder content while waiting for component rendering? #868
Comments
@PierreGUI See this article: Rearchitecting Airbnb’s Frontend and scroll down to lazy loading. Does that give you some ideas? Why not use server rendering? |
Hey Justin thanks for your answer :)
This would be React + ReactDOM (and Redux, etc...). At least 400kB (before gzip), it's definitely a OK size (mine is bigger) but I still think showing some HTML while downloading would be better for slow connections. Server side rendering? Edit: now trying |
So I managed to get what I want using server-side rendering (again, awesome work with react on rails). I got one special bundle that gets rendered server side to serve an HTML placeholder \o/ Took me about a day to change my webpack config, split my bundle, fix some other stuff (including monkeypatch execJS context to have native I18n :') ) etc... Seriously, I believe this would be an awesome feature to provide out of the box. A quick win for anyone in the need of showing some HTML while the JS loads ;) Again thanks for feedback, |
@PierreGUI I'd love to see some sample github repos and possibly some suggestions or actual PRs for React on Rails, and maybe the https://github.com/shakacode/react-webpack-rails-tutorial. |
@PierreGUI feel free to reopen this. |
Hi there,
Thanks for this amazing gem, really good work!
I'm working on improving the user experience on first page load. I use few components across the page (shared redux store). Even though components are quite small my bundle still is a few hundreds of kB and it can take a while to load with slow connection. While bundle is loading, page shows HTML but none of the React content, which can confuse my users as they don't see full content (sometimes for almost a minute).
One first solution would be server side rendering, so the page loads with pre-rendered HTML.
I'd like the content to be different then, for example showing a spinner (components rely on API call anyway). What if I could specify some placeholder HTML to be displayed while the bundle loads?
Rails would render the page with the provided HTML first (eg a spinner) and then replace it when the whole rendering cycle is done. I don't know how to achieve this today, what do you think?
Thanks
The text was updated successfully, but these errors were encountered: