Closed tanis2000 closed 7 years ago
Hi @tanis2000,
It's needed b/c for the first run at the client side, we already have HTML markup with some sort of data, fetched for this page at the server side. We already have all the data to render the page. So, we skip this.
But, actually, it's a react-router issue. React router renders tag while it calls onEnter prop. It needed b/c React is totally synchronous itself. And this cause of unexpected HTML markup for React and React throws an exception b/c expected markup should contain (at this render moment), not fully featured page from its point of view.
Thanks for the explanation!
I am trying to understand this part of the code:
https://github.com/olebedev/go-starter-kit/blob/master/client/router/routes.js#L18
Why are you skipping the first call to the onEnter function on the components? I feel like this is leading to some weird errors on my side. Maybe it's not related, but I'm not sure.
I added JWT authentication and there's a login component on the homepage. When I login successfully, it redirects to a new page (called gallery in my case) where the onEnter function actually grabs some data from an authenticated web service.
It looks like the call to that web service is being skipped. If I go back to the homepage and login again (and thus get redirected to the gallery page) this time it works fine.
Maybe that's completely unrelated but eventually you might know what's going on. Cheers!