From 8c73fd08530b244e95ebbea48d0e33e1ab5e1c42 Mon Sep 17 00:00:00 2001 From: 0xExp-po Date: Fri, 4 Oct 2024 18:29:21 +0900 Subject: [PATCH] chore: load project info after fetch --- dapp/src/components/ProjectInfo.astro | 12 ++++++------ dapp/src/pages/project/[project].astro | 5 ++++- 2 files changed, 10 insertions(+), 7 deletions(-) diff --git a/dapp/src/components/ProjectInfo.astro b/dapp/src/components/ProjectInfo.astro index 448cefb..64bb5d0 100644 --- a/dapp/src/components/ProjectInfo.astro +++ b/dapp/src/components/ProjectInfo.astro @@ -234,7 +234,6 @@ import DonateModal from "./DonateModal.astro"; import { updateConfig } from "../service/WriteContractService"; import { getProject } from "../service/ReadContractService"; import { - initializeProjectState, loadConfigData, loadProjectInfo, loadProjectLatestSha, @@ -249,9 +248,6 @@ import DonateModal from "./DonateModal.astro"; } from "../service/GithubService"; document.addEventListener("astro:page-load", () => { - initializeProjectState(); - projectInfoLoaded.set(true); - const modal = document.getElementById( "update-config-modal", ) as HTMLDialogElement; @@ -694,8 +690,12 @@ import DonateModal from "./DonateModal.astro"; } } - updateProjectInfo(); - updateUpgradeConfigButtonVisibility(); + projectInfoLoaded.subscribe((loaded) => { + if (loaded) { + updateProjectInfo(); + updateUpgradeConfigButtonVisibility(); + } + }); const button = document.querySelector( "[data-update-config]", diff --git a/dapp/src/pages/project/[project].astro b/dapp/src/pages/project/[project].astro index 11995df..91dbe7f 100644 --- a/dapp/src/pages/project/[project].astro +++ b/dapp/src/pages/project/[project].astro @@ -26,8 +26,9 @@ const { project } = Astro.params; \ No newline at end of file