Shared:Selectors: fix infinity use effect

This commit is contained in:
Timofey Boyko 2024-01-17 17:14:46 +03:00
parent 5b86d792ac
commit 4fd042b998
2 changed files with 5 additions and 4 deletions

View File

@ -72,7 +72,7 @@ const PeopleSelector = ({
const [itemsList, setItemsList] = useState(items);
const [searchValue, setSearchValue] = useState("");
const [total, setTotal] = useState(0);
const [total, setTotal] = useState<number>(-1);
const [hasNextPage, setHasNextPage] = useState(true);
const [isNextPageLoading, setIsNextPageLoading] = useState(false);
const [isLoading, setIsLoading] = useLoadingWithTimeout<boolean>(
@ -222,7 +222,8 @@ const PeopleSelector = ({
useEffect(() => {
loadNextPage(0);
}, [loadNextPage]);
// eslint-disable-next-line react-hooks/exhaustive-deps
}, []);
const emptyScreenImage = theme.isBase
? EmptyScreenPersonsSvgUrl

View File

@ -64,7 +64,7 @@ const RoomSelector = ({
const [hasNextPage, setHasNextPage] = React.useState(false);
const [isNextPageLoading, setIsNextPageLoading] = React.useState(false);
const [total, setTotal] = React.useState(0);
const [total, setTotal] = React.useState(-1);
const [items, setItems] = React.useState<TSelectorItem[]>([]);
@ -134,7 +134,7 @@ const RoomSelector = ({
React.useEffect(() => {
onLoadNextPage(0);
}, [onLoadNextPage, searchValue]);
}, []);
return (
<Selector