Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Infinite loop on Stats bar #883

Open
jonkiky opened this issue Aug 4, 2023 · 0 comments
Open

Infinite loop on Stats bar #883

jonkiky opened this issue Aug 4, 2023 · 0 comments

Comments

@jonkiky
Copy link
Contributor

jonkiky commented Aug 4, 2023

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, };

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant