formState.isSubmitting stays true when the fetcher's submitting and idle states land in one render
Nessuno ha ancora preso questa issue.
Valutazione
- Difficoltà
- 2/5
- Tempo stimato
- 1-3 ore
- Idoneità per principianti
- 82/100
- Tipo di issue
- Bug
- Chiarezza
- Specificata chiaramente
- Stato di attività
- Attiva
- Stack tecnologico
- react, typescript
- Ambito
- frontend
Direzione di ricerca
Inizia dall’implementazione di useRemixForm e individua l’effetto che reimposta isSubmittingNetwork quando isSubmittingForm è false. Riproduci il problema con un’action rapida e un modulo fetcher usando createRoutesStub; l’issue indica la modifica proposta alle dipendenze. Il lavoro è terminato quando formState.isSubmitting viene reimpostato dopo la risposta, anche se contiene errori, e il pulsante di invio si riattiva.
Scritto dal modello di indicizzazione a partire dal testo della issue.
Descrizione
useRemixForm sets isSubmittingNetwork to true in onSubmit and only clears it in an effect that depends on [isSubmittingForm]. When the action responds quickly, React Router can apply the fetcher's submitting and idle states in a single render. isSubmittingForm then stays false the whole time, the effect never re-runs, and formState.isSubmitting stays true until the component remounts. The form's submit button stays disabled after the response, including when the response has errors.
Reproduction: a route whose action returns immediately (for example () => ({ errors: { root: { message: 'Save failed' } } })) and a fetcher form whose button uses disabled={formState.isSubmitting}. Rendered with createRoutesStub in a unit test, it reproduces every time: the error shows, but the button never re-enables. In the browser it happens when the response arrives before React renders the submitting state, which we saw with a busy main thread.
Fix we're using as a patch: also reset when new data arrives:
useEffect(() => {
if (!isSubmittingForm) {
setIsSubmittingNetwork(false);
}
}, [isSubmittingForm, data]);
Seen on 7.2.1. 7.3.0 and main have the same effect.
- Lingua principale
- TypeScript
- Stelle
- 454
- Fork
- 44
- Metriche di merge delle PR
- Nessuna PR unita negli ultimi 30g
Preparare l'ambiente
- Nessun Dockerfile né file Docker Compose
- Ha un modello di pull request
- Nessuna guida per i contributori
Come iniziare
- Leggi tutta la issue e poi la guida ai contributi del progetto.
- Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
- Fai un fork del repository e lavora su un branch.
- Apri una pull request che faccia riferimento al numero della issue.
Altre issue di code-forge-io/remix-hook-form
-
`remix-hook-form/middleware` imports `unstable_createContext`, breaking on `react-router` >= 7.9.0Aperta
Difficoltà 2/5 1-3 ore Idoneità per principianti 76/100
code-forge-io/remix-hook-form#189 ·
-
good first issue help wanted
Difficoltà 5/5 Più di una settimana Idoneità per principianti 30/100
code-forge-io/remix-hook-form#123 · 1 reazione ·
Tutte le issue di code-forge-io/remix-hook-form
Issue simili
-
bug
Difficoltà 2/5 1-3 ore Idoneità per principianti 68/100
langchain-ai/langchainjs#12239 ·
I maintainer di solito rispondono entro 1 giorno
-
Board view: the Monitoring column is always empty because compact issue rows drop displayStatusAperta
Difficoltà 1/5 Meno di un'ora Idoneità per principianti 88/100
paperclipai/paperclip#21837 ·
I maintainer di solito rispondono entro 1 giorno
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 73/100
code-yeongyu/senpi#6813 ·
I maintainer di solito rispondono entro 1 giorno
-
community first-timers-only good first issue hacktoberfest help wanted low hanging fruit up-for-grabs
Difficoltà 1/5 Meno di un'ora Idoneità per principianti 93/100
lingdojo/kana-dojo#34169 · 1 commento · 5 reazioni ·
I maintainer di solito rispondono entro 1 giorno
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 78/100