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'm not 100% of the behaviour of updateQueryData. Say we have a getAllPosts endpoint which stores normalized posts data and also opens a Websocket connection for more atomic updates, all done according to the docs.
Whenever we receive a post update through the Websocket connection, we use updateQueryData along with adapter.upsertOne to update the all posts cache. We also use selectors to read from the cache across the app.
Here's my issue, it seems that this operation is slower than expected because the action that gets fired contains all the data from the cache instead of just the updated post. Why is this? Can't it just send the update post along with it's id so that we can update only one of the entities in the cache.
Also, because of this all of the selectors rerun whenever we do this. What's the best practice in this case? Do we create a getPost that only gets updated by the Websocket connection and read from that?
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
Uh oh!
There was an error while loading. Please reload this page.
-
I'm not 100% of the behaviour of
updateQueryData
. Say we have agetAllPosts
endpoint which stores normalized posts data and also opens a Websocket connection for more atomic updates, all done according to the docs.Whenever we receive a post update through the Websocket connection, we use
updateQueryData
along withadapter.upsertOne
to update the all posts cache. We also use selectors to read from the cache across the app.Here's my issue, it seems that this operation is slower than expected because the action that gets fired contains all the data from the cache instead of just the updated post. Why is this? Can't it just send the update post along with it's id so that we can update only one of the entities in the cache.
Also, because of this all of the selectors rerun whenever we do this. What's the best practice in this case? Do we create a
getPost
that only gets updated by the Websocket connection and read from that?Beta Was this translation helpful? Give feedback.
All reactions