Hi, I have issues with SSR in Svelte.
-
Flashing of the content - first, the page gets loaded really fast via SSR, then everything disappears in order to appear again (nothing changes from the the initial SSR version). When client-routing, it only happens on the first load, then the client router handles updates without this flashing. I found mentions of such problems for React and Vue (but it might not be the same thing). Is there a solution to it so it doesn’t flash?
-
I have to have two ways to load data for components - depending on whether it is loaded on the server or client. Is that necessary?
<script>
$m: {
// guard subscriptions as they are not available on the server
if (Meteor.isClient) Meteor.subscribe("links.all")
}
let links
if (Meteor.isServer) {
links = LinksCollection.find().fetch() // initially SSR-load data
}
// or wait for the subscription on the client, it will not finish within SSR
$m: links = LinksCollection.find().fetch();
</script>
- Head data gets duplicated - SSR pushes its version, then hydration duplicates it again. I need SSR head data for SEO. But I also need to at least to change titles on client navigation (while the other SSR-related entries linger in the head incorrectly; but those are generally not crucial for users). It might be just a Svelte bug though Issues · sveltejs/svelte · GitHub
A repo where you can see the flashing (the <H1>
is different to make it more noticeable) and duplicated entries in <head>
.