fix: tabbing between edit panel and group list panel crashes rendering

This commit is contained in:
Spectralitree 2021-12-31 17:17:40 +01:00
parent 728740a429
commit cdd9c664fc
2 changed files with 6 additions and 6 deletions

View File

@ -42,9 +42,9 @@
$: indexOfLastItem = currentPage * 10;
$: indexOfFirstItem = indexOfLastItem - 10;
$: pageAmount = Math.ceil(membersInGroup.length / 10);
$: pageAmount = Math.ceil(membersInGroup && membersInGroup.length / 10);
$: finalMemberList = membersInGroup.slice(indexOfFirstItem, indexOfLastItem);
$: finalMemberList = membersInGroup && membersInGroup.slice(indexOfFirstItem, indexOfLastItem);
let settings = JSON.parse(localStorage.getItem('pk-settings'));
let listGroupElements: any[] = [];
@ -114,7 +114,7 @@ function memberListRenderer(item: any) {
<FaUserFriends />
</div>Current Members</h5>
<ListPagination bind:currentPage bind:pageAmount bind:smallPages/>
{#if finalMemberList.length > 0}
{#if finalMemberList && finalMemberList.length > 0}
<ListGroup>
{#each finalMemberList as member, index (member.id)}
<ListGroupItem class="d-flex"><span bind:this={listGroupElements[index]} class="d-flex justify-content-between flex-grow-1"><span><b>{member.name}</b> (<code>{member.id}</code>)</span> <span>{member.display_name ? `${member.display_name}` : ""}</span></span></ListGroupItem>

View File

@ -43,9 +43,9 @@
$: indexOfLastItem = currentPage * 10;
$: indexOfFirstItem = indexOfLastItem - 10;
$: pageAmount = Math.ceil(groupsWithMember.length / 10);
$: pageAmount = Math.ceil(groupsWithMember && groupsWithMember.length / 10);
$: finalGroupsList = groupsWithMember.slice(indexOfFirstItem, indexOfLastItem);
$: finalGroupsList = groupsWithMember && groupsWithMember.slice(indexOfFirstItem, indexOfLastItem);
let settings = JSON.parse(localStorage.getItem('pk-settings'));
let listGroupElements: any[] = [];
@ -115,7 +115,7 @@
<FaFolderOpen />
</div>Current Groups</h5>
<ListPagination bind:currentPage bind:pageAmount bind:smallPages/>
{#if finalGroupsList.length > 0}
{#if finalGroupsList && finalGroupsList.length > 0}
<ListGroup>
{#each finalGroupsList as group, index (group.id)}
<ListGroupItem class="d-flex"><span bind:this={listGroupElements[index]} class="d-flex justify-content-between flex-grow-1"><span><b>{group.name}</b> (<code>{group.id}</code>)</span> <span>{@html group.display_name ? `${toHTML(group.display_name)}` : ""}</span></span></ListGroupItem>