You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Single fetch was a great addition, we absolutely love it! Now that we are able to get promises as part of loader data, we found ourselves in this situation:
1- we use useFetcher to load a loader data that returns an object that has some keys with Promise values
2- When useFetcher starts loading and after the data loads we get a re-render
3- Now we have to deal with the promise in the returned data and set the state accordingly (first to pending, and then fulfilled state)
In this case we are getting 4 re-renders until we get a hold of the desired data. A new type of useFetcher that has async load function and doesn't update state and handles the "remix stuff" (deserialization, handling redirects etc) would be handy. That way we could deal with the returned promise only and have 2 re-renders (one for pending state one for fulfilled)
The current best alternative seem to be using fetch directly and handling deserialization & "remix stuff" by ourselves.
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
-
Single fetch was a great addition, we absolutely love it! Now that we are able to get promises as part of loader data, we found ourselves in this situation:
1- we use
useFetcher
to load a loader data that returns an object that has some keys withPromise
values2- When useFetcher starts loading and after the data loads we get a re-render
3- Now we have to deal with the promise in the returned data and set the state accordingly (first to pending, and then fulfilled state)
In this case we are getting 4 re-renders until we get a hold of the desired data. A new type of
useFetcher
that has async load function and doesn't update state and handles the "remix stuff" (deserialization, handling redirects etc) would be handy. That way we could deal with the returned promise only and have 2 re-renders (one for pending state one for fulfilled)The current best alternative seem to be using
fetch
directly and handling deserialization & "remix stuff" by ourselves.Beta Was this translation helpful? Give feedback.
All reactions