Way to know whether remote function is redirecting us
Nobody has claimed this yet.
- Dominant language
- JavaScript
- Stars
- 20.8k
- Forks
- 2.3k
- Avg merge
- 1d 16h
- Merged PRs (30d)
- 156
Description
Describe the problem
After a remote form function is executed, there is no way to know whether we are being redirected. A use case for this is to disable the form after submission. We can use form.pending to disable all the form controls while submitting, but the form controls will then be enabled again while we are being redirected.
Reproduction: https://www.sveltelab.dev/4q5x27lrbyj9y7n?files=.%2Fsrc%2Froutes%2F%2Bpage.svelte%2C.%2Fsrc%2Flib%2Fdata.remote.js
Describe the proposed solution
Some way to know whether we are being redirected. Maybe form.redirecting? Or it could be exposed in the return value of submit in enhance, but I don't think that would work for query and prerender.
Alternatives considered
No response
Importance
would make my life easier
Additional Information
No response
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by running the linked reproduction and reading src/routes/+page.svelte together with src/lib/data.remote.js to understand the form submission flow. Define and implement a way for callers to know that a remote form operation is redirecting, covering the stated enhance, query, and prerender cases, then verify that controls can remain disabled through the redirect.
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
- Quiet
- Clarity
- Needs clarification
- Newbie friendliness
- 35/100