You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
In v1 version of this library there was a prop to disable SSR. It was very useful to me. Is it possible to add it again or can you suggest some other quick and convenient workaround?
The text was updated successfully, but these errors were encountered:
Hi, I have a project which used this feature and I thought I would share my workaround in case anyone finds it useful.
Previously, my project (using ReactJS and Redux) was using v1.0.6 and the Frontload component was passed a boolean: noServerRender={noSsr}
I updated to v2.0.0 and found that wasn't supported any more. In fact, without a server side render, I found frontloadMeta.serverRendered was set to true so frontload didn't actually resolve any of the promises.
This sets serverRendered to true if this is the first render. That seems like a bug to me but may be correct in other situations.
Anyway I created a function to override isFirstRender and provide whatever logic I want:
var createClientFrontloadState = ((_super) => { return (args) => { var state = _super(args); state.isFirstRender = () => state.serverRender !== undefined && state.serverRender.pass > -1; return state; } })(createFrontloadState.client)
One thing to note is that state.isFirstRender returns false unless state.serverRender.pass is greater than -1. That's technically the wrong way round. It should return false if a serverRender is detected.
It's possible, in future src/index.tsx:406 becomes:
In v1 version of this library there was a prop to disable SSR. It was very useful to me. Is it possible to add it again or can you suggest some other quick and convenient workaround?
The text was updated successfully, but these errors were encountered: