From 65396ce3797988c39be5e716fb09eeb095459521 Mon Sep 17 00:00:00 2001 From: Nikita Galaiko Date: Thu, 3 Aug 2023 09:01:22 +0200 Subject: [PATCH] show both expand / collapse all --- src/routes/repo/[projectId]/BranchLane.svelte | 30 +++++++++---------- 1 file changed, 15 insertions(+), 15 deletions(-) diff --git a/src/routes/repo/[projectId]/BranchLane.svelte b/src/routes/repo/[projectId]/BranchLane.svelte index 26148b5c0..c6a9e5772 100644 --- a/src/routes/repo/[projectId]/BranchLane.svelte +++ b/src/routes/repo/[projectId]/BranchLane.svelte @@ -104,14 +104,18 @@ allExpanded = undefined; } } - function handleToggleExpandAll() { - if (allExpanded == true) { - files.forEach((f) => setExpandedWithCache(f, false)); - allExpanded = false; - } else { - files.forEach((f) => setExpandedWithCache(f, true)); - allExpanded = true; - } + + $: allCollapsed = files.every((f) => getExpandedWithCacheFallback(f) === false); + + function handleCollapseAll() { + files.forEach((f) => setExpandedWithCache(f, false)); + allExpanded = false; + files = files; + } + + function handleExpandAll() { + files.forEach((f) => setExpandedWithCache(f, true)); + allExpanded = true; files = files; } @@ -526,13 +530,9 @@ Unapply - - {#if allExpanded} - Collapse all - {:else} - Expand all - {/if} - + Expand all + + Collapse all