`getFetcherType` doesn't return `done` after submit
Xelson opened this issue · 0 comments
Xelson commented
Describe the bug
If a fetcher submitting to an action
handler that returns null
then getFetcherType
returns idle
after submission instead of done
.
This happens because the initial fetcher.data
value is undefined
, but in the code if (fetcher.state === "idle" && fetcher.data != null) return "done", fetcher.data
is being checked for null
Your Example Website or App
https://stackblitz.com/edit/remix-run-remix-hpas2u?file=app%2Froutes%2F_index.tsx
Steps to Reproduce the Bug or Issue
- Go to stackblitz page with reproduce example;
- Press every button on the page. The alert about submission will appear only after pressing the second one.
Expected behavior
If fetcher is triggering action
which returning null
value, getFetcherType
should be done
, not idle
Screenshots or Videos
No response
Platform
- OS: Windows 10
- Browser: Brave
Additional context
No response