-
Notifications
You must be signed in to change notification settings - Fork 27
Description
We found an issue, when query data for stats bar fails, it will fall into Infinite loop to retry fetching data from backend.
In the AllStateController.js, when state,stats.isFetched is true , it will stop dispatch to make another API call.
AllStateController.js
const Stats = () => { const data = useSelector((state) => { if (!state.stats.isFetched) { const dispatch = useDispatch(); dispatch(fetchDataForStats()); } return state.stats.data; });
In redux state, when query data fails, isFetched property is false, it will result in dispatching fetchDataForStats event, until query get data successfully. When backend is not back, it will make infinite call to the backend.
StatsState.js
case STATS_QUERY_ERR: return { ...state, hasError: true, error: action.error, isLoading: false, isFetched: false, };