diff options
author | Viktor Vorona <viktor.vorona@sonarsource.com> | 2023-06-27 09:50:47 +0200 |
---|---|---|
committer | sonartech <sonartech@sonarsource.com> | 2023-06-27 20:02:45 +0000 |
commit | 429d06da1778d47aec0afe3790c1f9c0cb6361b5 (patch) | |
tree | 7dcf8475943d5430fdcc7b90b55a653ef1af8693 /server/sonar-web/src/main/js/apps/projectInformation | |
parent | 8563e5b8f90d55b0a67486807652af5adb4b2b67 (diff) | |
download | sonarqube-429d06da1778d47aec0afe3790c1f9c0cb6361b5.tar.gz sonarqube-429d06da1778d47aec0afe3790c1f9c0cb6361b5.zip |
[NO-JIRA] Fixing code smells
Diffstat (limited to 'server/sonar-web/src/main/js/apps/projectInformation')
-rw-r--r-- | server/sonar-web/src/main/js/apps/projectInformation/about/components/MetaTags.tsx | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/server/sonar-web/src/main/js/apps/projectInformation/about/components/MetaTags.tsx b/server/sonar-web/src/main/js/apps/projectInformation/about/components/MetaTags.tsx index 68ce51c2bc1..65a075d8e25 100644 --- a/server/sonar-web/src/main/js/apps/projectInformation/about/components/MetaTags.tsx +++ b/server/sonar-web/src/main/js/apps/projectInformation/about/components/MetaTags.tsx @@ -37,7 +37,7 @@ export default function MetaTags(props: Props) { const canUpdateTags = () => { const { configuration } = props.component; - return configuration && configuration.showSettings; + return configuration?.showSettings; }; const setTags = (values: string[]) => { @@ -63,7 +63,7 @@ export default function MetaTags(props: Props) { ); }; - const tags = props.component.tags || []; + const tags = props.component.tags ?? []; return ( <> @@ -91,6 +91,7 @@ interface MetaTagsSelectorProps { } const LIST_SIZE = 10; +const MAX_LIST_SIZE = 100; function MetaTagsSelector({ selectedTags, setProjectTags }: MetaTagsSelectorProps) { const [searchResult, setSearchResult] = useState<string[]>([]); @@ -99,7 +100,7 @@ function MetaTagsSelector({ selectedTags, setProjectTags }: MetaTagsSelectorProp const onSearch = (query: string) => { return searchProjectTags({ q: query, - ps: Math.min(selectedTags.length - 1 + LIST_SIZE, 100), + ps: Math.min(selectedTags.length - 1 + LIST_SIZE, MAX_LIST_SIZE), }).then( ({ tags }) => setSearchResult(tags), () => {} |