Hey everyone. I'm new in this Laravel + Inertia + Vue + Tailwind + Node world, so I appreciate your patience.
In my current setup, Inertia is working perfectly. After setting up SSR, this is how I was running it.
php artisan inertia:start-ssr
php artisan serve --port=3000 & npm run dev
I have also "hydratated" app.js.
When running it like this, this is what happens:
-I see a Flash of unstyled content (FOUC, new concept I just learned), where there's a split of a second where the CSS is not being loaded.
-There are some styles and images that are not being loaded
-There are lots of hydratation errors like this in the console:
[Vue warn]: Hydration node mismatch:
- rendered on server: <div class="relative hidden sm:block mt-28">…</div>
- expected on client
Still, SSR is working. I tried lots of stuff and hair tearing to understand what was going on.
Then I checked the documentation again, and by running npm run build it did the job. No more hydratation problems and SSR working properly.
So, it would be great if someone could confirm if I'm getting all of this right:
- npm run build works because it needs to build all the pages, and this way SSR version works and matches both app.js and ssr.js versions?
- When developing the site, should I run it with npm run dev and set app.js to createApp, and then when building change it for createSSRApp?
- I'm trying to grasp the whole concept of hydratation. Does this mean that the page will load fully rendered in html, but still operative with js?
- When working with SSR, is the first page served as full html and the subsequent loads as js?
There are too many new concepts for me that I'm trying to figure out, so any concept clarification here is really appreciated :)