From 9793e1e07a4e6aa3097738b5e91a7302f8cf1ad6 Mon Sep 17 00:00:00 2001 From: sylenien Date: Thu, 13 Oct 2022 15:08:10 +0200 Subject: [PATCH] change(ui): fetch meta list when session list is open --- .../components/SessionList/SessionList.tsx | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/frontend/app/components/shared/SessionListContainer/components/SessionList/SessionList.tsx b/frontend/app/components/shared/SessionListContainer/components/SessionList/SessionList.tsx index ec4c0cec9..d3c678c76 100644 --- a/frontend/app/components/shared/SessionListContainer/components/SessionList/SessionList.tsx +++ b/frontend/app/components/shared/SessionListContainer/components/SessionList/SessionList.tsx @@ -7,6 +7,7 @@ import AnimatedSVG, { ICONS } from 'Shared/AnimatedSVG/AnimatedSVG'; import { fetchSessions, addFilterByKeyAndValue, updateCurrentPage, setScrollPosition } from 'Duck/search'; import useTimeout from 'App/hooks/useTimeout'; import { numberWithCommas } from 'App/utils'; +import { fetchListActive as fetchMetadata } from 'Duck/customField'; const AUTOREFRESH_INTERVAL = 5 * 60 * 1000; const PER_PAGE = 10; @@ -23,6 +24,7 @@ interface Props { updateCurrentPage: (page: number) => void; setScrollPosition: (scrollPosition: number) => void; fetchSessions: (filters: any, force: boolean) => void; + fetchMetadata: () => void; activeTab: any; isEnterprise?: boolean; } @@ -53,8 +55,8 @@ function SessionList(props: Props) { useTimeout(() => { props.fetchSessions(null, true); }, AUTOREFRESH_INTERVAL); - - + + useEffect(() => { // handle scroll position const { scrollY } = props; @@ -62,7 +64,8 @@ function SessionList(props: Props) { if (total === 0) { props.fetchSessions(null, true); } - + props.fetchMetadata() + return () => { props.setScrollPosition(window.scrollY); }; @@ -148,5 +151,5 @@ export default connect( activeTab: state.getIn(['search', 'activeTab']), isEnterprise: state.getIn(['user', 'account', 'edition']) === 'ee', }), - { updateCurrentPage, addFilterByKeyAndValue, setScrollPosition, fetchSessions } + { updateCurrentPage, addFilterByKeyAndValue, setScrollPosition, fetchSessions, fetchMetadata } )(SessionList);