kit
kit copied to clipboard
Expose `form` property in `page` store
Describe the problem
The new actions and forms api is very good, but I was very surprised (probably misread the docs and migration guide) to find out that the form prop is not exposed in the page store.
Since we can have both export let data and $page.data, I think it would make a lot of sense to have to same for form.
Moreover, if I want to access the form property outside of +page.svelte (like in a +layout.svelte or a component further down the tree), the current api requires me to do a lot of setup, like for example populating a store with the data, exposing the data through context or passing the data as a prop. For one page, this is not too bad, but having to do this for every route is very cumbersome.
I realize I can access the result prop in the enhance callback, but again, it requires more setup if I want to use this data to populate input values and errors, and it would not work without js.
Describe the proposed solution
Add the form prop to the page store.
Alternatives considered
Do this in userland, like using a store, context or passing the data as prop. In every page.
Importance
would make my life easier
Additional Information
This issue brought the issue count back to 300, sorry for this :)