AssigneeSelect component in the ISSUE TRACKER is getting a runtime error

Hey everyone. I have tried a lot of things to try and make this work but on my code I have a <Select.Item /> that needs to have a value prop and i am getting a run time error saying: Error: A <Select.Item /> must have a value prop that is not an empty string. This is because the Select value can be set to an empty string to clear the selection and show the placeholder.
When @Mosh coded this out he just leaves an empty string like the following: <Select.Item value="">Unassigned</Select.Item>
and its supposed to go to this:
<Select.Root defaultValue={issue?.assignedToUserId || ""} onValueChange={(userId) => { axios.patch("/api/issues/" + issue.id, { assignedToUserId: userId || null, }); }} >

I get the run time error i shared first. But even if i fill it in with a space, letter, period or anything, it does not do that || (or) null like mosh has it. I keep hitting the validation errors in my API … i guess i at least know those work.

If any of you have encountered this issue, or may have a solution or want to get together on line and see if we could solve it, i would appreciate it. I was thinking of showing this off to a second round of interviews im going to have in the next two weeks.

Thanks for the support guys!

I figured this out last night after i posted it … The solution was so simple, and I can’t believe i did not think of it earlier. I used a ternary operator. So, my solution is different than @Mosh but on my machine I’m not getting that run time error I was getting prior.

1 Like