[#286] Don't allow server-side initialization of any pages #287
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Windrift does not need any server-side rendering: the main app container page needs to do server-side file access to load the config YAML files, and in multiplayer there are server-side API pages, but there is no reason to pre-render any React pages on the server and in many cases with
next export
there is no server at all.Since the first version in NextJS, I've observed an error in the CLI console "redux-persist failed to create sync storage. falling back to noop storage" which was hinting at the problem—on the server side Redux was trying to initialize a server-side store! This is unnecessary in all environments and is particularly unnecessary in multiplayer, when an external database serves as the state-tracking mechanism.
This PR moves all the Redux initialization inside a dynamically-loaded component marked with
ssr: false
, meaning it will not be initialized on the server side at all and just returnsnull
.