]> source.dussan.org Git - sonarqube.git/commitdiff
SONAR-20478 fix configuration form refreshing
authorViktor Vorona <viktor.vorona@sonarsource.com>
Thu, 28 Sep 2023 15:11:47 +0000 (17:11 +0200)
committersonartech <sonartech@sonarsource.com>
Fri, 29 Sep 2023 20:02:47 +0000 (20:02 +0000)
server/sonar-web/src/main/js/apps/settings/components/authentication/Authentication.tsx
server/sonar-web/src/main/js/queries/settings.ts

index f7e2e199427a43f9efc22f510f2110a85ac0e9b5..a095444c20bfc6f94e5234d53ef0f4661c190577 100644 (file)
@@ -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 (
     <>
       <header className="page-header">
@@ -166,16 +174,12 @@ export function Authentication(props: Props & WithAvailableFeaturesProps) {
                 id={getTabPanelId(tab.key)}
               >
                 <div className="big-padded-top big-padded-left big-padded-right">
-                  {tab.key === SAML && (
-                    <SamlAuthenticationTab
-                      definitions={definitions.filter((def) => def.subCategory === SAML)}
-                    />
-                  )}
+                  {tab.key === SAML && <SamlAuthenticationTab definitions={samlDefinitions} />}
 
                   {tab.key === AlmKeys.GitHub && (
                     <GithubAuthenticationTab
                       currentTab={currentTab}
-                      definitions={definitions.filter((def) => def.subCategory === AlmKeys.GitHub)}
+                      definitions={githubDefinitions}
                     />
                   )}
 
index 8142d3e7d08cd423f7b839a274b9a5d4a84a5960..c55f7f1f53c72cf0717faefa4dc26e46667e599c 100644 (file)
  * 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) {