Skip to content

Commit

Permalink
Fix incorrect dataProvider leads to infinite render loop
Browse files Browse the repository at this point in the history
Closes #4094
  • Loading branch information
fzaninotto committed Dec 2, 2019
1 parent dcf1d6e commit 24508a9
Showing 1 changed file with 12 additions and 6 deletions.
18 changes: 12 additions & 6 deletions packages/ra-core/src/dataProvider/useQueryWithStore.ts
Original file line number Diff line number Diff line change
Expand Up @@ -117,12 +117,18 @@ const useQueryWithStore = (
loaded: data !== undefined && !isEmptyList(data),
});
if (!isEqual(state.data, data) || state.total !== total) {
setState({
...state,
data,
total,
loaded: true,
});
if (isNaN(total)) {
console.error(
'Total from response is not a number. Please check your dataProvider or the API.'
);
} else {
setState({
...state,
data,
total,
loaded: true,
});
}
}
const dataProvider = useDataProvider();
useEffect(() => {
Expand Down

0 comments on commit 24508a9

Please sign in to comment.