Closed rodshtein closed 3 years ago
Will track in #9
Faced a problem: when I navigate from a dynamic route to the same level page, the url is updated, the gql requests data, but the page is not redrawn. Only if I use hard reload.
Code example with the same issue: https://github.com/EddyVinck/sapper-graphql-template/blob/dev/src/routes/blog/%5Bslug%5D.svelte
The reason: sveltejs/sapper#1278
Your example loads the client from the cache, but how would a bot scanning your site load cache to get ssr meta data?
@jdgamble555
First of all - it's not my example, I just found a repository that represents the same issue 🤗
And the second one - when you get the first load Sapper will generate flat HTML and then hydrate it.
That controlled by Preload code section. The search bot loads every page from scratch.
@zamkevich Ok, thanks. I wasn't sure if it was cached on the actual server or not, as that would be useful for ssr search bot. Not sure how that is solved.
@jdgamble555 It's achieved by run preload function on BFF for the first load. The function get all data and put into HTML. After hydration, all next calls the Preload function will be run on the client. All requests must be isomorphic (works for Node and Browser environment).
@zamkevich Does it actually update the HTML before it is loaded or does it update it VIA javascript? For example: A search engine bot cannot read javascript, but it can read html/meta tags etc. Can I change the source html from the server this way?
@jdgamble555 Yes, you can.
Faced a problem: when I navigate from a dynamic route to the same level page, the url is updated, the gql requests data, but the page is not redrawn. Only if I use hard reload.
Code example with the same issue: https://github.com/EddyVinck/sapper-graphql-template/blob/dev/src/routes/blog/%5Bslug%5D.svelte
The reason: https://github.com/sveltejs/sapper/issues/1278