What you were expecting:
The Query component should send a request on update only when the props have changed.
What happened instead:
Sends request on every update
Steps to reproduce:
Create a deep payload object for the Query component.
Related code:
const payload = {
id: record.id,
target: 'author',
sort: {
order: 'DESC',
field: 'createdAt'
},
pagination: {
page: 1,
perPage: 1
}
}
return (
<Query
type='GET_MANY_REFERENCE'
resource={constants.resources.posts}
payload={payload}
>
{({ data, loading, error }) => {
return <></>
</Query>
)
Other information:
A solution could be to change shallowEqual in the Query's componentDidUpdate to deepEqual.
Environment
- React-admin version: 2.9.0
- Last version that did not exhibit the issue (if applicable): -
- React version: 16.6.3
- Browser: Google Chrome 73
- Stack trace (in case of a JS error): -
What you were expecting:
The Query component should send a request on update only when the props have changed.
What happened instead:
Sends request on every update
Steps to reproduce:
Create a deep payload object for the Query component.
Related code:
Other information:
A solution could be to change shallowEqual in the Query's componentDidUpdate to deepEqual.
Environment