From cdd9c664fca62779bf3f39e0489ff2bc9738814d Mon Sep 17 00:00:00 2001
From: Spectralitree <72747870+Spectralitree@users.noreply.github.com>
Date: Fri, 31 Dec 2021 17:17:40 +0100
Subject: [PATCH] fix: tabbing between edit panel and group list panel crashes
rendering
---
src/lib/group/MemberEdit.svelte | 6 +++---
src/lib/member/GroupEdit.svelte | 6 +++---
2 files changed, 6 insertions(+), 6 deletions(-)
diff --git a/src/lib/group/MemberEdit.svelte b/src/lib/group/MemberEdit.svelte
index a1dc8673..8a6f1393 100644
--- a/src/lib/group/MemberEdit.svelte
+++ b/src/lib/group/MemberEdit.svelte
@@ -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) {
Current Members
- {#if finalMemberList.length > 0}
+ {#if finalMemberList && finalMemberList.length > 0}
{#each finalMemberList as member, index (member.id)}
{member.name} ({member.id}
) {member.display_name ? `${member.display_name}` : ""}
diff --git a/src/lib/member/GroupEdit.svelte b/src/lib/member/GroupEdit.svelte
index 1832c5ec..969557a1 100644
--- a/src/lib/member/GroupEdit.svelte
+++ b/src/lib/member/GroupEdit.svelte
@@ -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 @@
Current Groups
- {#if finalGroupsList.length > 0}
+ {#if finalGroupsList && finalGroupsList.length > 0}
{#each finalGroupsList as group, index (group.id)}
{group.name} ({group.id}
) {@html group.display_name ? `${toHTML(group.display_name)}` : ""}