Skip to content
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

[#286] Don't allow server-side initialization of any pages #287

Merged
merged 1 commit into from
Mar 8, 2022

Conversation

lizadaly
Copy link
Owner

@lizadaly lizadaly commented Mar 8, 2022

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 returns null.

@lizadaly lizadaly merged commit 6d0786f into main Mar 8, 2022
@lizadaly lizadaly deleted the return-null-ssr branch March 8, 2022 15:19
@lizadaly lizadaly mentioned this pull request Mar 8, 2022
lizadaly added a commit that referenced this pull request Mar 8, 2022
* Small tweaks to readme to get Vercel to update the main deployment (#280)

* [#286] Don't allow server-side initialization of any pages (#287)

* Fix import of container

* Fix import of container
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant