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
I am confused as to where would you put an async API call during the server side rendering?
For example to fetch the Pokemon and put it in the initial state alongside the counter value?
So, before preloadState initialization you can do: await Promise.all(dispatch(api.util.getRunningQueriesThunk()))
and insert the result to the preloadState.
I will try to add prefetching example into the next update.
Repository owner locked and limited conversation to collaborators on Nov 20, 2022
Activity
StopNGo commentedon Nov 18, 2022
Hello! Thanks for the evaluation.
Here is how it should work:
https://redux-toolkit.js.org/rtk-query/usage/server-side-rendering#server-side-rendering-elsewhere
So, before preloadState initialization you can do:
await Promise.all(dispatch(api.util.getRunningQueriesThunk()))and insert the result to the preloadState.
I will try to add prefetching example into the next update.