Query using already fetched data from redux store
Opened this issue · 3 comments
planetcrypton commented
I my our setup we want the query HOC to fetch the data, save it in the redux store (which it obviously does), but reuse that data, when its component is mounted for a second time, and avoid that extra http call.
What would be a good way of achieving this?
stueynet commented
We have a similar issue. We are using getRelationship
as follows:
@query('message', api.getMessage, (perform, props) => (
perform({ threadId: props.match.params.threadId, messageId: props.messageId, include: 'user' })
))
@connect((state, props) => {
return (
{
user: props.message && getRelationship(state, props.message, 'user')
}
)
})
We would expect that once the related resources (users) are loaded, it should not require another api call at least for a specified amount of time. What we are finding is that each time we load the same message list, it makes all the individual user api calls as well for each message.