Skip to content
This repository has been archived by the owner on Aug 1, 2022. It is now read-only.

Commit

Permalink
fix(ui): remove flicker in commits view (#611)
Browse files Browse the repository at this point in the history
  • Loading branch information
cloudhead committed Jun 29, 2020
1 parent 453e902 commit 25d9a79
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 10 deletions.
9 changes: 1 addition & 8 deletions ui/Screen/Project/Commits.svelte
Expand Up @@ -3,11 +3,7 @@
import { format } from "timeago.js";
import * as path from "../../src/path.ts";
import {
commits as store,
fetchCommits,
formatTime,
} from "../../src/source.ts";
import { commits as store, formatTime } from "../../src/source.ts";
import { Remote } from "../../DesignSystem/Component";
import { Text } from "../../DesignSystem/Primitive";
Expand All @@ -16,9 +12,6 @@
export let params = null;
const projectId = params.id;
const branch = decodeURIComponent(params.branch);
fetchCommits({ projectId, branch });
</script>

<style>
Expand Down
16 changes: 14 additions & 2 deletions ui/Screen/Project/Source.svelte
@@ -1,14 +1,16 @@
<script>
import { getContext } from "svelte";
import { link, location } from "svelte-spa-router";
import { push, location } from "svelte-spa-router";
import { format } from "timeago.js";
import * as path from "../../src/path.ts";
import { project as projectStore } from "../../src/project.ts";
import {
currentPath,
currentRevision,
fetchCommits,
fetchRevisions,
commits as commitsStore,
object as objectStore,
ObjectType,
readme,
Expand All @@ -29,6 +31,15 @@
export const params = null;
const navigateOnReady = (path, store) => {
const unsubscribe = store.subscribe(state => {
if (state.status === "SUCCESS") {
push(path);
}
});
unsubscribe();
};
const updateRevision = (projectId, revision) => {
updateParams({
path: path.extractProjectSourceObjectPath($location),
Expand Down Expand Up @@ -59,6 +70,7 @@
revision: getRevision($currentRevision),
type: path.extractProjectSourceObjectType($location),
});
$: fetchCommits({ projectId: id, branch: getRevision($currentRevision) });
fetchRevisions({ projectId: id });
</script>
Expand Down Expand Up @@ -184,7 +196,7 @@
<!-- svelte-ignore a11y-missing-attribute -->
<a
data-cy="commits-button"
use:link={path.projectCommits(project.id, $currentRevision)}>
on:click={navigateOnReady(path.projectCommits(id, $currentRevision), commitsStore)}>
Commits
</a>
</Text>
Expand Down

0 comments on commit 25d9a79

Please sign in to comment.