Skip to content

Commit

Permalink
Form race condition (#12)
Browse files Browse the repository at this point in the history
* remove unneccesary logs

* prevent form submission until commit hash populates via github api
  • Loading branch information
eriktaubeneck authored Apr 4, 2024
1 parent 8b52733 commit aed46c4
Showing 1 changed file with 3 additions and 6 deletions.
9 changes: 3 additions & 6 deletions server/app/query/create/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -31,19 +31,15 @@ export default function Page() {
const newQueryId = NewQueryId();
setQueryId(newQueryId);
// Send a POST request to start the process
console.log("sending post");
const formData = new FormData(event.currentTarget);
for (const remoteServer of Object.values(remoteServers)) {
const response = await fetch(remoteServer.startURL(newQueryId), {
method: "POST",
body: formData,
});
const data = await response.json();
console.log(remoteServer);
console.log(data);
}

// const data = await response.json();
await new Promise((f) => setTimeout(f, 1000));

// Redirect to /query/view/<newQueryId>
Expand Down Expand Up @@ -327,9 +323,10 @@ function IPAForm({
type="submit"
className={clsx(
"mt-4 inline-flex items-center rounded-md bg-emerald-600 px-3 py-2 text-sm font-semibold text-white shadow-sm hover:bg-emerald-700 focus-visible:outline focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-emerald-600",
!validCommitHash && "opacity-25 hover:bg-emerald-600",
(!validCommitHash || selectedCommitHash === "") &&
"opacity-25 hover:bg-emerald-600",
)}
disabled={!validCommitHash}
disabled={!validCommitHash || selectedCommitHash === ""}
>
Start Query
</button>
Expand Down

0 comments on commit aed46c4

Please sign in to comment.