From 1c1a1a7a27c997ef5921baf241f050b07d57c372 Mon Sep 17 00:00:00 2001 From: Shekar Siri Date: Fri, 24 Dec 2021 16:19:15 +0530 Subject: [PATCH] feat(ui) - assist tabs show laoder --- .../components/AssistTabs/AssistTabs.tsx | 19 ++++++++++++++----- 1 file changed, 14 insertions(+), 5 deletions(-) diff --git a/frontend/app/components/Assist/components/AssistTabs/AssistTabs.tsx b/frontend/app/components/Assist/components/AssistTabs/AssistTabs.tsx index 8f0641200..1b1d694dd 100644 --- a/frontend/app/components/Assist/components/AssistTabs/AssistTabs.tsx +++ b/frontend/app/components/Assist/components/AssistTabs/AssistTabs.tsx @@ -3,7 +3,7 @@ import { connect } from 'react-redux'; import { applyFilter, addAttribute } from 'Duck/filters'; import { fetchList } from 'Duck/sessions'; import { KEYS } from 'Types/filter/customFilter'; -import { Link } from 'UI'; +import { Link, Loader } from 'UI'; import Filter from 'Types/filter'; import { List } from 'immutable'; import Counter from 'App/components/shared/SessionItem/Counter'; @@ -34,6 +34,13 @@ interface Props { const AssistTabs = React.memo((props: Props) => { const [showMenu, setShowMenu] = useState(false) + + useEffect(() => { + if (showMenu) { + props.fetchLiveList(); + } + }, [showMenu]) + useEffect(() => { if (!props.loading && props.list.size === 0) { props.fetchLiveList(); @@ -48,9 +55,11 @@ const AssistTabs = React.memo((props: Props) => { className="border z-10 absolute bg-white rounded shadow right-0" style={{ minWidth: "180px"}} > - {props.list.map((item, index) => ( - - ))} + + {props.list.map((item, index) => ( + + ))} + )} @@ -60,7 +69,7 @@ const AssistTabs = React.memo((props: Props) => { export default connect(state => { const session = state.getIn([ 'sessions', 'current' ]); return { - loading: state.getIn([ 'sessions', 'loading' ]), + loading: state.getIn([ 'sessions', 'fetchLiveListRequest', 'loading' ]), list: state.getIn(['sessions', 'liveSessions']).filter(i => i.userId === session.userId), session, filters: state.getIn([ 'filters', 'appliedFilter' ]),