Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: max depth error in equal prominence #1617

Merged
merged 2 commits into from
Aug 14, 2023
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ export function EqualProminence() {
const [pagesWithTiles, setPagesWithTiles] = useState([]);
const [page, setPage] = useState(0);
const [ref, { width, height }] = useMeasure();
const pageSize = pagesWithTiles[0]?.length;

useEffect(() => {
// currentPageIndex should not exceed pages length
Expand Down Expand Up @@ -129,14 +130,14 @@ export function EqualProminence() {
const peersSorter = new PeersSorter(vanillaStore);
peersSorter.setPeersAndTilesPerPage({
peers,
tilesPerPage: pagesWithTiles[0]?.length || maxTileCount,
tilesPerPage: pageSize || maxTileCount,
});
peersSorter.onUpdate(setSortedPeers);

return () => {
peersSorter.stop();
};
}, [page, vanillaStore, peers, pagesWithTiles, maxTileCount]);
}, [page, vanillaStore, peers, pageSize, maxTileCount]);

return (
<Flex direction="column" css={{ flex: '1 1 0', h: '100%', position: 'relative', minWidth: 0 }}>
Expand Down