Fix selected goal

This commit is contained in:
2023-09-29 11:03:33 +01:00
parent 11ead3e8bd
commit d9bcea518b
3 changed files with 9 additions and 7 deletions

View File

@ -36,11 +36,11 @@ function GoalSelector({ goal, pubkey, onGoalSelect }: GoalSelectorProps) {
const goals = useGoals(pubkey, true);
const { formatMessage } = useIntl();
return (
<select defaultValue={goal} onChange={ev => onGoalSelect(ev.target.value)}>
<select onChange={ev => onGoalSelect(ev.target.value)}>
<option value="">{formatMessage({ defaultMessage: "Select a goal..." })}</option>
{goals?.map(goal => (
<option key={goal.id} value={goal.id}>
{goal.content}
{goals?.map(x => (
<option key={x.id} value={x.id} selected={goal === x.id}>
{x.content}
</option>
))}
</select>
@ -57,7 +57,7 @@ export function StreamEditor({ ev, onFinish, options }: StreamEditorProps) {
const [tags, setTags] = useState<string[]>([]);
const [contentWarning, setContentWarning] = useState(false);
const [isValid, setIsValid] = useState(false);
const [goal, setGoal] = useState<string | undefined>();
const [goal, setGoal] = useState<string>();
const login = useLogin();
const { formatMessage } = useIntl();