fix(code/frontend): fix search filter duplicate items (#38858)
This commit is contained in:
parent
9c57df5e3f
commit
3a9dd77293
|
@ -88,7 +88,7 @@ export class SearchOptions extends Component<Props, State> {
|
||||||
let optionsFlyout;
|
let optionsFlyout;
|
||||||
const repoScope =
|
const repoScope =
|
||||||
this.state.defaultRepoScopeOn && this.props.defaultSearchScope
|
this.state.defaultRepoScopeOn && this.props.defaultSearchScope
|
||||||
? unique([...this.state.repoScope, this.props.defaultSearchScope], r => r.uri)
|
? unique([...this.state.repoScope, this.props.defaultSearchScope], (r: Repository) => r.uri)
|
||||||
: this.state.repoScope;
|
: this.state.repoScope;
|
||||||
if (this.state.isFlyoutOpen) {
|
if (this.state.isFlyoutOpen) {
|
||||||
const selectedRepos = repoScope.map(r => {
|
const selectedRepos = repoScope.map(r => {
|
||||||
|
@ -197,14 +197,17 @@ export class SearchOptions extends Component<Props, State> {
|
||||||
|
|
||||||
private onRepoChange = (repos: any) => {
|
private onRepoChange = (repos: any) => {
|
||||||
this.setState(prevState => ({
|
this.setState(prevState => ({
|
||||||
repoScope: unique([
|
repoScope: unique(
|
||||||
...prevState.repoScope,
|
[
|
||||||
...repos.map((r: any) =>
|
...prevState.repoScope,
|
||||||
[...this.props.repoSearchResults, ...this.props.defaultRepoOptions].find(
|
...repos.map((r: any) =>
|
||||||
rs => rs.name === r.label
|
[...this.props.repoSearchResults, ...this.props.defaultRepoOptions].find(
|
||||||
)
|
rs => rs.name === r.label
|
||||||
),
|
)
|
||||||
]),
|
),
|
||||||
|
],
|
||||||
|
(r: Repository) => r.uri
|
||||||
|
),
|
||||||
}));
|
}));
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue