#Multiple useFetchers in a single component

1 messages · Page 1 of 1 (latest)

dense moss
#

Is there any reason that multiple useFetchers can't be used in a single component? For example, I'm trying to separate out a "loader" fetcher from a "submitter" fetcher for the purpose of keeping their respective data values distinct.

dense moss
#

To add more info here, the problem i'm running into is that the data property of a useFetcher seems to not be isolated from other fetchers within the component. An example:

const { data: account, state, load } = useFetcher<Account>();
const { submit } = useFetcher();

In this example, the data from the first fetcher (which is used to load an Account) is overwritten by the response from the second fetcher's submit method  (note that it is eventually corrected when the first fetcher is revalidated)

paper drift
#

This must be a bug

frosty lava
#

Hm, yeah this isn't expected. Would you mind filing an issue on GitHub with a small reproduction?

frosty lava
#

ah, ok I found the issue here - will get this fixed shortly. Thanks for the callout!

dense moss
#

sweet, thanks!