fix loop on grid mode when pagination is active

This commit is contained in:
Ramón Souza 2024-04-11 17:44:44 -03:00
parent 156cdb7a3f
commit e52aa27422

View File

@ -530,30 +530,11 @@ class VideoService {
} }
getGridUsers(users, streams) { getGridUsers(users, streams) {
const pageSize = this.getMyPageSize();
const isPaginationDisabled = !this.isPaginationEnabled() || pageSize === 0;
const isGridEnabled = this.isGridEnabled(); const isGridEnabled = this.isGridEnabled();
let gridUsers = []; let gridUsers = [];
if (isPaginationDisabled) {
if (isGridEnabled) {
const streamUsers = streams.map((stream) => stream.userId);
gridUsers = users.filter(
(user) => !user.loggedOut && !user.left && !streamUsers.includes(user.userId),
).map((user) => ({
isGridItem: true,
...user,
}));
}
return gridUsers;
}
const paginatedStreams = this.getVideoPage(streams, pageSize);
if (isGridEnabled) { if (isGridEnabled) {
const streamUsers = paginatedStreams.map((stream) => stream.userId); const streamUsers = streams.map((stream) => stream.userId);
gridUsers = users.filter( gridUsers = users.filter(
(user) => !user.loggedOut && !user.left && !streamUsers.includes(user.userId), (user) => !user.loggedOut && !user.left && !streamUsers.includes(user.userId),