-
-
Notifications
You must be signed in to change notification settings - Fork 2k
Accumulate data into export let data
#5994
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
Comments
This is less work now than it used to be. You can use <!-- src/routes/+page.svelte (from the reproduction link). Could also be used in src/routes/+layout.svelte or any component, for example -->
<script>
import { page } from "$app/stores";
</script>
<div>
{JSON.stringify($page.data)}
</div> |
@babichjacob Thank you for the idea. Unfortunately, |
If it were done by default then the load functions could no longer run in parallel |
@benmccann Yes, but you're by default sacrificing the brevity and requiring more boilerplate for an unknown amount of performance optimization. One could optimize for performance by creating the .ts file with a specific |
This isn't a regression. Previously you would have had to have a Yes, of course the amount of performance optimisation is unknown. That would be a very silly reason for making things unnecessarily slow by default. |
Just for the record, I disagree. I think optimizing for brevity and developer productivity is more important than runtime performance, provided the developer has an option to optimize for it in specific cases when it's necessary. |
Our ultimate responsibility is to end users. We don't want to make it easy to build fast sites, we want to make it hard to build slow sites. It doesn't matter how conscientious individual developers are — if you have slowness baked into the system, optimizing it away will forever be on the backlog. That said, we realised that we can merge data without affecting the ability to run |
export let data
Describe the bug
This is an "opinionated" take on the recent changes to routes and
load
function behavior. It's a big change, that I am not a fan of but can see the merit. Among other things it now requires more boilerplate code, which we all don't like to deal with.Here's the problem: +page.svelte doesn't receive
data
unless there's +page.ts file withload
function even though we might havedata
set by parent layouts. This forces one to create a bunch of +page.ts files with a the following boilerplate. Wouldn't be nicer to do that as a default for all pages, so we don't have to create +page.ts files unless we're actually doing something specific there?Reproduction
https://stackblitz.com/edit/sveltejs-kit-template-default-f8ky2l?file=src/routes/+page.js
The +page.js file seems to be completely unnecessary but you can't remove it or +page receives no
data
.Logs
No response
System Info
Severity
serious, but I can work around it
Additional Information
No response
The text was updated successfully, but these errors were encountered: