You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I would like to recognize performance overhead regarding parent.
/** @type {import('./$types').PageLoad} */exportasyncfunctionload({ params, parent }){constparentData=awaitparent();// ^ `parent` function can execute later to avoid a waterfallconstdata=awaitgetData(params);return{
...datameta: { ...parentData.meta, ...data.meta}};}
Description
SvelteKit has parent function. And according to the document, parent should use at the bottom of load function as much as possible in terms of performance.
But it's too difficult to recognize by human code review, so I would like to recognize this automatically.
Examples
/** @type {import('./$types').PageLoad} */exportasyncfunctionload({ params, parent }){// NGconstparentData=awaitparent();constdata=awaitgetData(params);// OKconstparentData=awaitparent();// OK (Because `doSomething` needs to use the return value of `parent`.)constfoo=awaitdoSomething(parentData);return{
...datameta: { ...parentData.meta, ...data.meta}};}
Additional comments
I need to think about better rule name.😅
The text was updated successfully, but these errors were encountered:
Hmm. I'm not familiar with English, so I'm not sure what "waterfall" means. So I'm not sure if that naming of the rule makes sense 😓. I would like someone's opinion on that name.
But to protect waterfall, possibly we need to take care something more in the future, so I'd like to use a name that has a specific check purpose.
I mean "This is is just check the place of parent function. Not check everything regarding avoiding waterfall"
Motivation
I would like to recognize performance overhead regarding
parent
.Description
SvelteKit has
parent
function. And according to the document,parent
should use at the bottom ofload
function as much as possible in terms of performance.https://kit.svelte.dev/docs/load#using-parent-data
But it's too difficult to recognize by human code review, so I would like to recognize this automatically.
Examples
Additional comments
I need to think about better rule name.😅
The text was updated successfully, but these errors were encountered: