Skip to content

Commit

Permalink
fix: local tile not shown when no other publisher (#1780)
Browse files Browse the repository at this point in the history
* fix: local tile not shown when no other publisher

* fix: add code comment

* fix: add code comment
  • Loading branch information
raviteja83 authored Sep 1, 2023
1 parent bd22946 commit 518f853
Showing 1 changed file with 11 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,17 @@ export function EqualProminence({ isInsetEnabled = false, peers, onPageChange, o
const isMobile = useMedia(cssConfig.media.md);
let maxTileCount = useUISettings(UI_SETTINGS.maxTileCount);
maxTileCount = isMobile ? Math.min(maxTileCount, 6) : maxTileCount;
const inputPeers = useMemo(() => (peers.length === 0 ? (!localPeer ? [] : [localPeer]) : peers), [peers, localPeer]);
const pageList = usePagesWithTiles({
let pageList = usePagesWithTiles({
peers,
maxTileCount,
});
// useMemo is needed to prevent recursion as new array is created for localPeer
const inputPeers = useMemo(
() => (pageList.length === 0 ? (localPeer ? [localPeer] : []) : peers),
[pageList.length, peers, localPeer],
);
// Pass local peer to main grid if no other peer has tiles
pageList = usePagesWithTiles({
peers: inputPeers,
maxTileCount,
});
Expand Down

0 comments on commit 518f853

Please sign in to comment.