React Query does not take into account a state change when fetching data

Viewed 23

I'm using React Query to fetch data and I have a dropdown with multiple options which change the state (which changes the data displayed) according to the option selected.

The problem is that when I select an option, it will stay for half a second on the option selected, but then it will go back to the default option. But if I reselect the same option, it will work perfectly.

I'd like to know what I could do to make react-query not go back to the default option and stay with the option selected ?

Here's the code for my dropdowns : sandbox

The problematic part is the one where I change the form

Here's a video showing what happens (sorry for the poor quality)

0 Answers
Related