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;
|
||||
selectedCommunityChoice?: Choice;
|
||||
onSelectCommunity?: (choice: Choice) => void;
|
||||
initialCommunities: CommunityView[];
|
||||
initialCommunities?: CommunityView[];
|
||||
}
|
||||
|
||||
interface PostFormState {
|
||||
|
@ -124,24 +124,25 @@ export class PostForm extends Component<PostFormProps, PostFormState> {
|
|||
},
|
||||
communitySearchOptions: [selectedCommunityChoice]
|
||||
.concat(
|
||||
this.props.initialCommunities.map(
|
||||
this.props.initialCommunities?.map(
|
||||
({ community: { id, title } }) => ({
|
||||
label: title,
|
||||
value: id.toString(),
|
||||
})
|
||||
)
|
||||
) ?? []
|
||||
)
|
||||
.filter(option => option.value !== selectedCommunityChoice.value),
|
||||
};
|
||||
} else {
|
||||
this.state = {
|
||||
...this.state,
|
||||
communitySearchOptions: this.props.initialCommunities.map(
|
||||
communitySearchOptions:
|
||||
this.props.initialCommunities?.map(
|
||||
({ community: { id, title } }) => ({
|
||||
label: title,
|
||||
value: id.toString(),
|
||||
})
|
||||
),
|
||||
) ?? [],
|
||||
};
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue