Skip to content

Commit

Permalink
cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
eriktaubeneck committed Mar 21, 2024
1 parent fe55c92 commit d3375ba
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 19 deletions.
17 changes: 4 additions & 13 deletions server/app/query/create/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -114,6 +114,10 @@ function IPAForm({
}: {
handleIPAFormSubmit: (event: FormEvent<HTMLFormElement>) => void;
}) {
enum CommitSpecifier {
COMMIT_HASH,
BRANCH,
}
const owner = "private-attribution";
const repo = "ipa";
const [branches, setBranches] = useState<Branch[]>([]);
Expand All @@ -123,24 +127,11 @@ function IPAForm({
const [selectedCommitHash, setSelectedCommitHash] = useState<string>("");
const [validCommitHash, setValidCommitHash] = useState<boolean>(true);
const commitHashInputRef = useRef<HTMLInputElement>(null);

enum CommitSpecifier {
COMMIT_HASH,
BRANCH,
}
const [commitSpecifier, setCommitSpecifier] = useState<CommitSpecifier>(
CommitSpecifier.BRANCH,
);

const disableBranch = commitSpecifier != CommitSpecifier.BRANCH;
const disableCommitHash = commitSpecifier != CommitSpecifier.COMMIT_HASH;

function matchingCommitHashes(selectedCommitHash: string): string[] {
return commitHashes.filter((commit) =>
commit.startsWith(selectedCommitHash),
);
}

const filteredCommitHashes =
selectedCommitHash === ""
? []
Expand Down
8 changes: 2 additions & 6 deletions server/app/query/github.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -31,10 +31,8 @@ export async function Branches(
request: {
cache: bypassCache ? "reload" : "default",
},
timestamp: new Date().getTime(),
};
if (bypassCache) {
requestParams.timestamp = new Date().getTime();
}
const branchesIter = octokit.paginate.iterator(
octokit.rest.repos.listBranches,
requestParams,
Expand Down Expand Up @@ -70,10 +68,8 @@ export async function Commits(
request: {
cache: bypassCache ? "reload" : "default",
},
timestamp: new Date().getTime(),
};
if (bypassCache) {
requestParams.timestamp = new Date().getTime();
}
const commitsIter = octokit.paginate.iterator(
octokit.rest.repos.listCommits,
requestParams,
Expand Down

0 comments on commit d3375ba

Please sign in to comment.