Replies: 1 comment 3 replies
-
You can't call |
Beta Was this translation helpful? Give feedback.
3 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
I'm fetching details of a specific product and then editing that data.
The first time I call this variable, when nothing is stored in the cache yet, the promise remains pending until the data is returned, which works perfectly:
const data = await promise
However, on the second call, after the product data has been updated, the promise returns the previously cached value instead of the updated data.
What I expected was for the returned data to always be up to date. In the example I saw, the promise was used inside React.use(), but in my case, I’m simply calling await promise when the component loads. Since a new request is made, I expected to receive the latest data.
I need to handle the data asynchronously within my component, which prevents me from using hooks like isFetching, isLoading, and data. Given this scenario, would this be a misuse of the API or an actual bug?
Beta Was this translation helpful? Give feedback.
All reactions