web/settings: make version info optional, wait for load
This commit is contained in:
parent
23c9eb73aa
commit
89181c6ddc
2 changed files with 4 additions and 10 deletions
|
@ -1,4 +1,5 @@
|
|||
import { readable } from "svelte/store";
|
||||
import type { Optional } from "./types/generic";
|
||||
|
||||
type VersionResponse = {
|
||||
commit: string;
|
||||
|
@ -7,15 +8,8 @@ type VersionResponse = {
|
|||
version: string;
|
||||
}
|
||||
|
||||
const unknownVersion = {
|
||||
commit: "unknown",
|
||||
branch: "unknown",
|
||||
remote: "unknown",
|
||||
version: "unknown"
|
||||
};
|
||||
|
||||
export const version = readable<VersionResponse>(
|
||||
unknownVersion,
|
||||
export const version = readable<Optional<VersionResponse>>(
|
||||
undefined,
|
||||
(set) => {
|
||||
fetch('/version.json')
|
||||
.then(r => r.json())
|
||||
|
|
|
@ -25,7 +25,7 @@
|
|||
|
||||
let screenWidth: number;
|
||||
|
||||
$: versionText = `v.${$version.version}-${$version.commit.slice(0, 7)}`;
|
||||
$: versionText = $version ? `v${$version.version}-${$version.commit.slice(0, 8)}` : '\xa0';
|
||||
|
||||
$: currentPageTitle = $page.url.pathname.split("/").at(-1);
|
||||
$: stringPageTitle =
|
||||
|
|
Loading…
Reference in a new issue