Fix loading indicator bug

This commit is contained in:
Alexis Sellier
2021-06-20 22:18:05 +02:00
parent 09f90e4160
commit 30088670cc
3 changed files with 8 additions and 7 deletions
+2 -2
View File
@@ -65,7 +65,7 @@
// component, eg. when using the browser's "back" button.
$: getBlob = loadBlob(path);
$: getAnchor = org ? Org.getAnchor(org, urn, config) : null;
$: loading = state.status == Status.Loading ? state.path : null;
$: loadingPath = state.status == Status.Loading ? state.path : null;
</script>
<style>
@@ -210,7 +210,7 @@
{#if tree.entries.length}
<div class="column-left">
<div class="source-tree">
<Tree {tree} {path} {fetchTree} {loading} on:select={onSelect} />
<Tree {tree} {path} {fetchTree} {loadingPath} on:select={onSelect} />
</div>
</div>
<div class="column-right">
+3 -3
View File
@@ -10,7 +10,7 @@
export let fetchTree: (path: string) => Promise<Tree>;
export let path: string;
export let tree: Tree;
export let loading: string | null = null;
export let loadingPath: string | null = null;
const dispatch = createEventDispatcher();
const onSelect = ({ detail: path }: { detail: string }): void => {
@@ -22,7 +22,7 @@
{#if entry.info.objectType === ObjectType.Tree}
<Folder
{fetchTree}
{loading}
{loadingPath}
name={entry.info.name}
prefix={`${entry.path}/`}
currentPath={path}
@@ -31,7 +31,7 @@
{:else}
<File
active={entry.path === path}
loading={entry.path === loading}
loading={entry.path === loadingPath}
name={entry.info.name}
on:click={() => onSelect({ detail: entry.path })}
/>
+3 -2
View File
@@ -11,7 +11,7 @@
export let name: string;
export let prefix: string;
export let currentPath: string;
export let loading: string | null = null;
export let loadingPath: string | null = null;
let expanded = currentPath.indexOf(prefix) === 0;
let tree: Promise<Tree> | null = expanded ? fetchTree(prefix) : null;
@@ -78,11 +78,12 @@
name={entry.info.name}
on:select={onSelectFile}
prefix={`${entry.path}/`}
{loadingPath}
{currentPath} />
{:else}
<File
active={entry.path === currentPath}
loading={entry.path === loading}
loading={entry.path === loadingPath}
name={entry.info.name}
on:click={() => {
onSelectFile({ detail: entry.path });