Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

getFetcherType doesn't return done after submit #323

Open
Xelson opened this issue Mar 21, 2024 · 0 comments
Open

getFetcherType doesn't return done after submit #323

Xelson opened this issue Mar 21, 2024 · 0 comments

Comments

@Xelson
Copy link

Xelson commented Mar 21, 2024

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

  1. Go to stackblitz page with reproduce example;
  2. 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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant