]> source.dussan.org Git - sonarqube.git/commitdiff
SONAR-20392 Do not show save when setting is set to initial state in GitHub Authentic...
authorMathieu Suen <mathieu.suen@sonarsource.com>
Fri, 15 Sep 2023 07:30:57 +0000 (09:30 +0200)
committersonartech <sonartech@sonarsource.com>
Fri, 15 Sep 2023 20:03:06 +0000 (20:03 +0000)
server/sonar-web/src/main/js/apps/settings/components/authentication/hook/useConfiguration.ts

index 6070c0401fef8769d2845da469fd9feed01b3375..8cb7f0d31f5c67cfc4532a5343aa16a72f4fe969 100644 (file)
@@ -21,7 +21,7 @@ import { UseMutationResult } from '@tanstack/react-query';
 import { every, isEmpty, keyBy, update } from 'lodash';
 import { useCallback, useEffect, useState } from 'react';
 import { useGetValuesQuery, useResetSettingsMutation } from '../../../../../queries/settings';
-import { ExtendedSettingDefinition } from '../../../../../types/settings';
+import { ExtendedSettingDefinition, SettingType } from '../../../../../types/settings';
 import { Dict } from '../../../../../types/types';
 
 export type SettingValue =
@@ -119,7 +119,13 @@ export default function useConfiguration(
   const isValueChange = useCallback(
     (setting: string) => {
       const value = values[setting];
-      return value && value.newValue !== undefined && (value.value ?? '') !== value.newValue;
+      if (!value) {
+        return false;
+      }
+      if (value.definition.type === SettingType.BOOLEAN) {
+        return value.newValue !== undefined && (value.value === 'true') !== value.newValue;
+      }
+      return value.newValue !== undefined && (value.value ?? '') !== value.newValue;
     },
     [values],
   );