import React, { useEffect } from 'react'; import { fetchList } from 'Duck/sessions'; import { connect } from 'react-redux'; import { NoContent, Loader } from 'UI'; import { List, Map } from 'immutable'; import SessionItem from 'Shared/SessionItem'; const AUTOREFRESH_INTERVAL = 1 * 60 * 1000 interface Props { loading: Boolean, list?: List, fetchList: (params) => void, applyFilter: () => void, filters: List } function LiveSessionList(props: Props) { const { loading, list, filters } = props; var timeoutId; useEffect(() => { props.fetchList(filters.toJS()); timeout(); return () => { clearTimeout(timeoutId) } }, []) const timeout = () => { timeoutId = setTimeout(() => { props.fetchList(filters.toJS()); timeout(); }, AUTOREFRESH_INTERVAL); } return (
See how to {'enable Assist'} if you haven't yet done so. } image={} show={ !loading && list && list.size === 0} > {list && list.map(session => ( ))}
) } export default connect(state => ({ list: state.getIn(['sessions', 'liveSessions']), loading: state.getIn([ 'sessions', 'loading' ]), filters: state.getIn([ 'filters', 'appliedFilter' ]), }), { fetchList })(LiveSessionList)