sveltejs / sveltejs/kit

Allow form action handlers to access data loaded by page/layout.

Open
#9,411 6 comments 2 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

forms
Dominant language
JavaScript
Stars
20.8k
Forks
2.3k
Avg merge
1d 16h
Merged PRs (30d)
156

Description

Describe the problem

In form action handler there is no way to call const myData = await parent()

Describe the proposed solution

The parent function could be made accessible in the scope of the handler

Alternatives considered

No response

Importance

would make my life easier

Additional Information

Workaround is using hooks to populate locals with the data needed

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by tracing SvelteKit's form action handlers and the page/layout data-loading path to understand how parent() is currently scoped. Determine whether handlers can safely access loaded data, then add coverage showing a handler can use the relevant parent data; done means the proposed access works without the hooks-based workaround.

Written by the indexing model from the issue text.

Assessment

Tech stack
javascript
Domain
web-dev
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.