Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[SAPPER] Routing between dynamic pages issue #59

Closed
rodshtein opened this issue Sep 27, 2020 · 7 comments
Closed

[SAPPER] Routing between dynamic pages issue #59

rodshtein opened this issue Sep 27, 2020 · 7 comments

Comments

@rodshtein
Copy link

rodshtein commented Sep 27, 2020

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

@rodshtein rodshtein changed the title Routing between dynamic pages issue [SAPPER] Routing between dynamic pages issue Sep 28, 2020
@timhall
Copy link
Owner

timhall commented Nov 18, 2020

Will track in #9

@timhall timhall closed this as completed Nov 18, 2020
@jdgamble555
Copy link

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?

@rodshtein
Copy link
Author

@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.

@jdgamble555
Copy link

@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.

@rodshtein
Copy link
Author

@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).

@jdgamble555
Copy link

@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?

@rodshtein
Copy link
Author

@jdgamble555 Yes, you can.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants