Skip to content

Commit

Permalink
fix: job category suggest (#241)
Browse files Browse the repository at this point in the history
  • Loading branch information
aaronvanston authored Nov 5, 2020
1 parent a98f28f commit ed472eb
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 5 deletions.
5 changes: 5 additions & 0 deletions .changeset/forty-ads-love.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'wingman-fe': patch
---

fix(JobCategorySuggest): set current value of managed radio group
Original file line number Diff line number Diff line change
Expand Up @@ -31,16 +31,14 @@ const JobCategorySuggestChoices = forwardRef<HTMLInputElement, Props>(
{ choices, onSelect, showConfidence = false, ...restProps },
forwardedRef,
) => {
const [selectedJobCategory, setSelectedJobCategory] = useState<
JobCategory
>();
const [selectedJobCategory, setSelectedJobCategory] = useState<number>();

const handleChoiceSelect = (event: React.FormEvent<HTMLInputElement>) => {
const index = Number(event.currentTarget.value);

const choice = choices[index];

setSelectedJobCategory(choice.jobCategory);
setSelectedJobCategory(index);

if (onSelect) {
onSelect(choice);
Expand All @@ -56,7 +54,7 @@ const JobCategorySuggestChoices = forwardRef<HTMLInputElement, Props>(
<RadioGroup
id="job-category-suggest-select"
onChange={handleChoiceSelect}
value={selectedJobCategory?.id.value ?? ''}
value={selectedJobCategory ?? ''}
{...restProps}
>
{choices.map((choice, index) => {
Expand Down

0 comments on commit ed472eb

Please sign in to comment.