Skip to content

Commit

Permalink
chore: load project info after fetch
Browse files Browse the repository at this point in the history
  • Loading branch information
0xExp-po committed Oct 4, 2024
1 parent 6393707 commit 8c73fd0
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 7 deletions.
12 changes: 6 additions & 6 deletions dapp/src/components/ProjectInfo.astro
Original file line number Diff line number Diff line change
Expand Up @@ -234,7 +234,6 @@ import DonateModal from "./DonateModal.astro";
import { updateConfig } from "../service/WriteContractService";
import { getProject } from "../service/ReadContractService";
import {
initializeProjectState,
loadConfigData,
loadProjectInfo,
loadProjectLatestSha,
Expand All @@ -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;
Expand Down Expand Up @@ -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]",
Expand Down
5 changes: 4 additions & 1 deletion dapp/src/pages/project/[project].astro
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,9 @@ const { project } = Astro.params;
<script>
import { fetchTOMLFromConfigUrl } from "../../service/GithubService";
import { getProject, getProjectHash } from "../../service/ReadContractService";
import { setConfigData, setProject, setProjectId, setProjectLatestSha, setProjectRepoInfo } from "../../service/StateService";
import { initializeProjectState, setConfigData, setProject, setProjectId, setProjectLatestSha, setProjectRepoInfo } from "../../service/StateService";
import { getAuthorRepo } from "../../utils/editLinkFunctions";
import { projectInfoLoaded } from "../../utils/store";
document.addEventListener("astro:page-load", async () => {
const projectElement = document.querySelector('main') as HTMLElement;
const projectName = projectElement?.dataset.project;
Expand Down Expand Up @@ -95,6 +96,8 @@ const { project } = Astro.params;
setProjectLatestSha(latestSha);
} else setProjectLatestSha("");
}
initializeProjectState();
projectInfoLoaded.set(true);
}
});
</script>

0 comments on commit 8c73fd0

Please sign in to comment.