Fix more reactivity issues

Signed-off-by: Alexis Sellier <self@cloudhead.io>
This commit is contained in:
Alexis Sellier
2022-02-11 23:07:31 +01:00
parent 27895b7d0c
commit 7e9e407382
4 changed files with 13 additions and 4 deletions
+4 -1
View File
@@ -14,6 +14,7 @@
const switchBranch = (name: string) => {
dispatch("branchChanged", name);
};
let branchLabel: string | null = null;
$: branchList = Object.keys(branches).sort();
@@ -22,8 +23,10 @@
$: commit = getOid(revision, branches) || head;
$: if (commit == head) {
branchLabel = project.defaultBranch;
} else if (! isOid(revision)) {
} else if (branches[revision]) {
branchLabel = revision;
} else {
branchLabel = null;
}
</script>
+2
View File
@@ -24,6 +24,8 @@
$: if (Object.keys(browser.branches).length > 0) {
branches = browser.branches;
} else {
proj.browse({ branches });
}
let dropdownState: { [key: string]: boolean } = { clone: false, seed: false, branch: false, peer: false };
+1 -1
View File
@@ -11,7 +11,7 @@
let { urn, seed } = source;
const navigateHistory = (revision: string, content?: ProjectContent) => {
proj.navigateTo({ content, revision }, source);
proj.navigateTo({ content, revision, path: null }, source);
};
const fetchCommits = async (parentCommit: string): Promise<GroupedCommitsHistory> => {
const commitsQuery = await getCommits(urn, parentCommit, seed.api);
+6 -2
View File
@@ -43,6 +43,11 @@
{ prop: "og:description", content: project.description },
{ prop: "og:url", content: window.location.href }
]);
// Necessary for the initial load, but causes double rendering.
// Once the content routing is above this component, this can go
// away.
$: revision = $browserStore.revision;
</script>
<style>
@@ -114,8 +119,7 @@
<div class="description">{source.project.description}</div>
</header>
<!-- TODO: Should reivision be null? -->
{#await proj.getRoot(source.project, null, peer, source.seed.api) then { tree, branches, commit }}
{#await proj.getRoot(source.project, revision, peer, source.seed.api) then { tree, branches, commit }}
<Header {tree} {branches} {commit} {browserStore} {source} {peerSelector} />
<ProjectContentRoutes {tree} {peer} {branches} {browserStore} {source} />
{:catch err}