From: Viktor Vorona Date: Thu, 28 Sep 2023 15:11:47 +0000 (+0200) Subject: SONAR-20478 fix configuration form refreshing X-Git-Tag: 10.3.0.82913~307 X-Git-Url: https://source.dussan.org/?a=commitdiff_plain;h=f68a36b738c15cb02c3a1c431f4da360adb53758;p=sonarqube.git SONAR-20478 fix configuration form refreshing --- diff --git a/server/sonar-web/src/main/js/apps/settings/components/authentication/Authentication.tsx b/server/sonar-web/src/main/js/apps/settings/components/authentication/Authentication.tsx index f7e2e199427..a095444c20b 100644 --- a/server/sonar-web/src/main/js/apps/settings/components/authentication/Authentication.tsx +++ b/server/sonar-web/src/main/js/apps/settings/components/authentication/Authentication.tsx @@ -112,6 +112,14 @@ export function Authentication(props: Props & WithAvailableFeaturesProps) { }, ] as const; + const [samlDefinitions, githubDefinitions] = React.useMemo( + () => [ + definitions.filter((def) => def.subCategory === SAML), + definitions.filter((def) => def.subCategory === AlmKeys.GitHub), + ], + [definitions], + ); + return ( <>
@@ -166,16 +174,12 @@ export function Authentication(props: Props & WithAvailableFeaturesProps) { id={getTabPanelId(tab.key)} >
- {tab.key === SAML && ( - def.subCategory === SAML)} - /> - )} + {tab.key === SAML && } {tab.key === AlmKeys.GitHub && ( def.subCategory === AlmKeys.GitHub)} + definitions={githubDefinitions} /> )} diff --git a/server/sonar-web/src/main/js/queries/settings.ts b/server/sonar-web/src/main/js/queries/settings.ts index 8142d3e7d08..c55f7f1f53c 100644 --- a/server/sonar-web/src/main/js/queries/settings.ts +++ b/server/sonar-web/src/main/js/queries/settings.ts @@ -18,20 +18,15 @@ * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ import { useMutation, useQuery, useQueryClient } from '@tanstack/react-query'; -import { isEqual } from 'lodash'; import { getValue, getValues, resetSettingValue, setSettingValue } from '../api/settings'; import { ExtendedSettingDefinition } from '../types/settings'; type SettingValue = string | boolean | string[]; export function useGetValuesQuery(keys: string[]) { - return useQuery( - ['settings', 'values', keys] as const, - ({ queryKey: [_a, _b, keys] }) => { - return getValues({ keys }); - }, - { structuralSharing: (prev, next) => (isEqual(prev, next) ? prev : next) }, - ); + return useQuery(['settings', 'values', keys] as const, ({ queryKey: [_a, _b, keys] }) => { + return getValues({ keys }); + }); } export function useGetValueQuery(key: string) {