-
I'm using form actions and I have a action that's nested under a layout.server.ts file. I believe one can do it by adding a load funciton to the same +page.server.ts file, get the org from the parent and store it in a global variabe, BUT this is not recomended as of the docs. How can we access parent data inside a action? |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment
-
Load functions only re-run after the form action has completed, so The request to the form action is a completely fresh request, so the best thing to do is to re-retrieve the logged in user's organization in the form action itself. |
Beta Was this translation helpful? Give feedback.
Load functions only re-run after the form action has completed, so
await parent
is not supported. The global variable approach is not recommended either, since that will leak between requests.The request to the form action is a completely fresh request, so the best thing to do is to re-retrieve the logged in user's organization in the form action itself.