Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- let intervalID = 0;
- useEffect(() => {
- intervalID = setInterval(() => dispatch(eventsAction(jiraCode)), 5000);
- if(finished) {
- clearInterval(intervalID);
- }
- }, [finished]);
- useEffect(() => {
- if(tableData?.length && (tableData[0]['status'] === 'POD:COMPLETE' || tableData[0]['status'] === 'POD:FAILED')) {
- clearInterval(intervalID);
- setFinished(true);
- }
- }, [tableData]);// eslint-disable-line react-hooks/exhaustive-deps
- // clear errors
- useEffect(() => {
- dispatch(clearErrorsAction());
- return () => clearInterval(intervalID);
- }, []);// eslint-disable-line react-hooks/exhaustive-deps
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement