There's a simpler solution I believe that I found in this medium article: https://kulembetov.medium.com/preventing-flash-of-unstyled-content-fouc-in-next-js-applications-61b9a878f0f7
Basically, it consists of adding visibility: hidden; to the body element by default and then adding the visibility back client side once the main layout has mounted (like so for instance: document.body.classList.add('body-visible');