Skip to content
This repository was archived by the owner on May 30, 2024. It is now read-only.

Commit ac2b0c1

Browse files
author
Noah Hanjun Lee
authored
Fix errors from type casting in UI (#141)
* Fix typo: `addTagManually`
1 parent 247a4ed commit ac2b0c1

File tree

3 files changed

+5
-5
lines changed

3 files changed

+5
-5
lines changed

Diff for: ui/src/components/ApproversSelect.tsx

+2-2
Original file line numberDiff line numberDiff line change
@@ -32,9 +32,9 @@ export default function ApproversSelect(props: ApproversSelectProps): JSX.Elemen
3232
}, 800)
3333

3434
const _onSelectCandidate = (id: string) => {
35-
const candidate = props.candidates.find(c => c.id.toString() ===id)
35+
const candidate = props.candidates.find(c => c.id === parseInt(id))
3636
if (candidate === undefined) {
37-
return
37+
throw new Error("The candidate is undefined.")
3838
}
3939

4040
onSelectCandidate(candidate)

Diff for: ui/src/redux/repoDeploy.tsx

+1-1
Original file line numberDiff line numberDiff line change
@@ -224,7 +224,7 @@ export const addTagManually = createAsyncThunk<Tag, string, { state: {repoDeploy
224224
const { namespace, name } = getState().repoDeploy
225225

226226
try {
227-
const tag = await getTag(namespace, name, name)
227+
const tag = await getTag(namespace, name, tagName)
228228
return tag
229229
} catch(e) {
230230
if (e instanceof HttpNotFoundError) {

Diff for: ui/src/views/Deployment.tsx

+2-2
Original file line numberDiff line numberDiff line change
@@ -101,14 +101,14 @@ export default function DeploymentView(): JSX.Element {
101101
}
102102

103103
const onSelectCandidate = (id: string) => {
104-
const approval = approvals.find(a => a.user?.id.toString() === id)
104+
const approval = approvals.find(a => a.user?.id === parseInt(id))
105105

106106
if (approval !== undefined) {
107107
dispatch(deleteApproval(approval))
108108
return
109109
}
110110

111-
const candidate = candidates.find(c => c.id.toString() === id)
111+
const candidate = candidates.find(c => c.id === parseInt(id))
112112
if (candidate === undefined) {
113113
throw new Error("The candidate is not found")
114114
}

0 commit comments

Comments
 (0)