`query` accessible from page store during prerendering, but shouldn't be
See original GitHub issueDescribe the bug
Building with sveltejs/adapter-static
does not give me the correct query.
svelte-kit dev
and svelte-kit preview
work fine.
However, if I build with @sveltejs/adapter-static
, I don’t get the correct query parameters.
Especially after a reload.
Reproduction
https://github.com/ssssota/sveltekit-static-query
Logs
No response
System Info
❯ npx envinfo --system --binaries --browsers --npmPackages "{svelte,@sveltejs/*,vite}"
System:
OS: Windows 10 10.0.19042
CPU: (12) x64 AMD Ryzen 5 2600 Six-Core Processor
Memory: 8.18 GB / 15.93 GB
Binaries:
Node: 14.17.0 - C:\Program Files\nodejs\node.EXE
Yarn: 1.22.11 - ~\AppData\Roaming\npm\yarn.CMD
npm: 7.20.2 - C:\Program Files\nodejs\npm.CMD
Browsers:
Chrome: 92.0.4515.159
Edge: Spartan (44.19041.1023.0), Chromium (92.0.902.84)
Internet Explorer: 11.0.19041.906
npmPackages:
@sveltejs/adapter-static: ^1.0.0-next.18 => 1.0.0-next.18
@sveltejs/kit: next => 1.0.0-next.162
svelte: ^3.42.4 => 3.42.4
Severity
serious, but I can work around it
Additional Information
I think the hydrate part of the initialization is suspicious.
import { start } from "/_app/start-19affe50.js";
start({
target: document.querySelector("#svelte"),
paths: {"base":"","assets":""},
session: {},
host: location.host,
route: true,
spa: false,
trailing_slash: "never",
hydrate: {
status: 200,
error: null,
nodes: [
import("/_app/pages/__layout.svelte-e8a46f20.js"),
import("/_app/pages/index.svelte-9233398d.js")
],
page: {
host: location.host, // TODO this is redundant
path: "/",
query: new URLSearchParams(""), /* 🤔 */
params: {}
}
}
});
Issue Analytics
- State:
- Created 2 years ago
- Comments:6 (2 by maintainers)
Top Results From Across the Web
Prerendering does not have any distinguishing HTTP headers
The header solution won't work. When a prerender is swapped in, no additional HTTP requests are made. The invisible tab is just made...
Read more >9 tricks to eliminate render blocking resources - LogRocket Blog
By reducing render blocking resources, you can shorten the critical rendering path and reduce page load times, thus improving UX and SEO.
Read more >Getting TypeError on prerendering page in npm run build
When handling a dynamic page such as /blog/[slug].jsx you need to use getStaticPaths in addition to getStaticProps and router.
Read more >Pre-render strategies in NextJS - Full Stack Developer Tips
This is a function that NextJS calls at build time, so all you have to do is return props and that data will...
Read more >Crawl Budget: 8 Ways to Optimize It for Better SEO Health
Here's how you can increase your crawl budget with Prerender. ... of user queries according to the ranking algorithm with the indexed pages....
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
No problem. I appreciate that you made this. There was an issue on our end that we didn’t alert you to the fact that it’s not possible.
I sent https://github.com/sveltejs/kit/pull/2363 to fix that
@benmccann Thank you for the reply and quick response. Please forgive me for making this Issue before I found #669, and for not understanding the exact problem.