-
-
Notifications
You must be signed in to change notification settings - Fork 2k
Force layout load
invalidation server-side
#7403
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
load
invalidation server-side
load
invalidation server-side
Not sure how relevant this is but I can't get a |
If you are using the form <form use:enhance={() => {
return async ({result}) => {
if (result.type === 'success' || result.type === 'redirect') {
await invalidateAll();
}
// ... your applyAction(result) logic, etc.
}
}}> Currently, it will only invalidate for success responses (anything that doesn't throw error, invalid, or redirect). This isn't a problem if you aren't using the Personally, I have struggled quite a bit with properly understanding the behaviour of |
I'm not sure I understand the preamble of the issue. In case JavaScript is not available, the next request goes back to the server. The server is stateless, so all load functions are rerun. I'm therefore closing this as a duplicate of the linked issues/discussions. |
Describe the problem
In cases where a layout's
load
method is returning sensitive data such as a user's profile, it would be great to have a serverside means of invalidating the parent layout from within a page'sload
. That way we don't have to rely on client-sideinvalidateAll()
if for whatever reason JS isn't working.Sample layout
load
:Describe the proposed solution
I noticed a few ideas floating around here:
Supply an
ignore
module to allow aload
function to decide when to not re-run based on specific criteria.parent()
function to force parent layout's to call theirload
method. It could beawait parent({ force: true })
locals
to act as a dependency so that if they change from withinhandle
or a page down theload
chain, it will invokeload
for a parent layoutAlternatives considered
load
by making use ofurl.pathname
locals
can be re-populated:Though I'm unsure if the layout's
load
will get called again after a redirect.Importance
would make my life easier
Additional Information
Related discussions:
+layout.server.js
tree #6315(my ticket may be a duplicate of this)
The text was updated successfully, but these errors were encountered: