Describe the problem
#2104 introduced throwing an error when page.query was accessed. This makes sense to prevent usage on the client, but now you cannot use it during load which was beneficial for prerendering crawled pages. For example, a page displaying a list of blog posts with pagination using a ?page=X query. As long as those can be crawled, using query is OK here.
Describe the proposed solution
Check if page.query is being accessed on the server before throwing the error
https://github.com/sveltejs/kit/pull/2104/files#diff-7266c49c71803f38dda70345d857f13a7a2494cc649b70af6b689627199f5b79R53-R63
Alternatives considered
I could use params instead, which is probably better in most scenarios, but in my case I'm using it on my index page and it's more awkward than using a query. I would prefer mywebsite.com/?page=2 over mywebsite.com/2.
Importance
would make my life easier
Additional Information
Here's an example of a template I made that utilized crawled pages with queries (you'll have to set const PAGE_SIZE = 1 in routes/index.svelte to get more than 1 page):
https://github.com/mattjennings/sveltekit-blog-template
The build will work with kit 1.0.0-next.144, but break on 145
Describe the problem
#2104 introduced throwing an error when page.query was accessed. This makes sense to prevent usage on the client, but now you cannot use it during
loadwhich was beneficial for prerendering crawled pages. For example, a page displaying a list of blog posts with pagination using a?page=Xquery. As long as those can be crawled, using query is OK here.Describe the proposed solution
Check if page.query is being accessed on the server before throwing the error
https://github.com/sveltejs/kit/pull/2104/files#diff-7266c49c71803f38dda70345d857f13a7a2494cc649b70af6b689627199f5b79R53-R63
Alternatives considered
I could use params instead, which is probably better in most scenarios, but in my case I'm using it on my index page and it's more awkward than using a query. I would prefer
mywebsite.com/?page=2overmywebsite.com/2.Importance
would make my life easier
Additional Information
Here's an example of a template I made that utilized crawled pages with queries (you'll have to set
const PAGE_SIZE = 1inroutes/index.svelteto get more than 1 page):https://github.com/mattjennings/sveltekit-blog-template
The build will work with kit 1.0.0-next.144, but break on 145