Skip to content
This repository has been archived by the owner on Oct 9, 2024. It is now read-only.

Restore Next's Automatic Static Optimization #183

Merged
merged 2 commits into from
Mar 10, 2021
Merged

Conversation

zb2oby
Copy link
Contributor

@zb2oby zb2oby commented Mar 9, 2021

Based on this Next.js thread : vercel/next.js#9285 (comment)

And more or less related to this issue : #161

I've made big changes in Redux implementation to avoid use of getInitialProps in order to restore Next.js Automatic Static Optimization.

It increases significantly performance on loading pages. I've gained a lot of speed at pages load time for this demo ! (not "scientifically" tested but i guess between 8 and 10 times faster)

However getInitialProps Or getServerSideProps can be useful for some use cases but as it sayed here : https://medium.com/swlh/fetching-and-hydrating-a-next-js-app-using-getserversideprops-and-getstaticprops-65bfe42afed8

If used properly, these methods can be very powerful but, at the same time, they can be very harmful to the performance of your app when not taken with care.

And indeed, it was ! ^^

@robbieaverill
Copy link
Contributor

Thank you for the awesome pull request @zb2oby, someone will review this soon and get it merged in

@jaepass
Copy link
Contributor

jaepass commented Mar 10, 2021

Heeyhey @zb2oby wow thanks for the PR! We had planned to eventually overhaul and upgrade this demo to using some of the latest Next features as you stated and eventually moving away from redux in favour of the Context API. Would be some significant changes, you can see some of the issues raised, feel free to contribute, add any feedback, or raise any other issues you see, . Have you explored using the getStaticProps hook? We aim to statically render products and categories from pre-built data when the project is upgraded to the latest version. Still happy to test this and if ok will merge, but eventually it might be overwritten.

@jaepass jaepass merged commit 85f80a7 into chec:master Mar 10, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants