Fix bug from last commit
This commit is contained in:
parent
46f2dd7457
commit
0c23f0564b
1 changed files with 10 additions and 9 deletions
|
@ -56,7 +56,7 @@ interface PostFormProps {
|
||||||
enableDownvotes?: boolean;
|
enableDownvotes?: boolean;
|
||||||
selectedCommunityChoice?: Choice;
|
selectedCommunityChoice?: Choice;
|
||||||
onSelectCommunity?: (choice: Choice) => void;
|
onSelectCommunity?: (choice: Choice) => void;
|
||||||
initialCommunities: CommunityView[];
|
initialCommunities?: CommunityView[];
|
||||||
}
|
}
|
||||||
|
|
||||||
interface PostFormState {
|
interface PostFormState {
|
||||||
|
@ -124,24 +124,25 @@ export class PostForm extends Component<PostFormProps, PostFormState> {
|
||||||
},
|
},
|
||||||
communitySearchOptions: [selectedCommunityChoice]
|
communitySearchOptions: [selectedCommunityChoice]
|
||||||
.concat(
|
.concat(
|
||||||
this.props.initialCommunities.map(
|
this.props.initialCommunities?.map(
|
||||||
({ community: { id, title } }) => ({
|
({ community: { id, title } }) => ({
|
||||||
label: title,
|
label: title,
|
||||||
value: id.toString(),
|
value: id.toString(),
|
||||||
})
|
})
|
||||||
)
|
) ?? []
|
||||||
)
|
)
|
||||||
.filter(option => option.value !== selectedCommunityChoice.value),
|
.filter(option => option.value !== selectedCommunityChoice.value),
|
||||||
};
|
};
|
||||||
} else {
|
} else {
|
||||||
this.state = {
|
this.state = {
|
||||||
...this.state,
|
...this.state,
|
||||||
communitySearchOptions: this.props.initialCommunities.map(
|
communitySearchOptions:
|
||||||
({ community: { id, title } }) => ({
|
this.props.initialCommunities?.map(
|
||||||
label: title,
|
({ community: { id, title } }) => ({
|
||||||
value: id.toString(),
|
label: title,
|
||||||
})
|
value: id.toString(),
|
||||||
),
|
})
|
||||||
|
) ?? [],
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue