change(ui) - search call optimizaation

This commit is contained in:
Shekar Siri 2023-02-03 12:06:22 +01:00
parent f541991e27
commit 57fbc1d134
2 changed files with 5 additions and 4 deletions

View file

@ -3,6 +3,7 @@ import { connect } from 'react-redux';
import { FilterKey } from 'Types/filter/filterType';
import SessionItem from 'Shared/SessionItem';
import { NoContent, Loader, Pagination, Button, Icon } from 'UI';
import { withRouter, RouteComponentProps } from 'react-router-dom';
import AnimatedSVG, { ICONS } from 'Shared/AnimatedSVG/AnimatedSVG';
import {
fetchSessions,
@ -22,7 +23,7 @@ enum NoContentType {
const AUTOREFRESH_INTERVAL = 5 * 60 * 1000;
let sessionTimeOut: any = null;
interface Props {
interface Props extends RouteComponentProps {
loading: boolean;
list: any;
currentPage: number;
@ -94,7 +95,7 @@ function SessionList(props: Props) {
// handle scroll position
const { scrollY } = props;
window.scrollTo(0, scrollY);
if (total === 0) {
if (total === 0 && props.history.location.search === "") {
props.fetchSessions(null, true);
}
props.fetchMetadata();
@ -226,4 +227,4 @@ export default connect(
fetchMetadata,
checkForLatestSessions,
}
)(SessionList);
)(withRouter(SessionList));

View file

@ -44,7 +44,7 @@ const SessionSearchQueryParamHandler = React.memo((props: Props) => {
};
const applyFilterFromQuery = () => {
if (appliedFilter.filters.size > 0) {
if (appliedFilter.filters.size > 0 || history.location.search === "") {
return;
}
const entires = getQueryObject(history.location.search);