korbit-ai[bot] commented on code in PR #33377:
URL: https://github.com/apache/superset/pull/33377#discussion_r2075623684


##########
superset-frontend/src/SqlLab/components/App/index.jsx:
##########
@@ -121,14 +124,27 @@
   }
 
   componentDidUpdate() {
+    const { localStorageUsageInKilobytes, actions, queries } = this.props;
+    const queryCount = queries?.lenghth || 0;
     if (
-      this.props.localStorageUsageInKilobytes >=
+      localStorageUsageInKilobytes >=
       LOCALSTORAGE_WARNING_THRESHOLD * LOCALSTORAGE_MAX_USAGE_KB
     ) {
       this.showLocalStorageUsageWarning(
-        this.props.localStorageUsageInKilobytes,
-        this.props.queries?.lenghth || 0,
+        localStorageUsageInKilobytes,
+        queryCount,
+      );
+    }
+    if (localStorageUsageInKilobytes > 0 && !this.hasLoggedLocalStorageUsage) {
+      const eventData = {
+        current_usage: localStorageUsageInKilobytes,
+        query_count: queryCount,
+      };
+      actions.logEvent(
+        LOG_ACTIONS_SQLLAB_MONITOR_LOCAL_STORAGE_USAGE,
+        eventData,
       );
+      this.hasLoggedLocalStorageUsage = true;

Review Comment:
   ### Uninitialized Class Property <sub>![category 
Readability](https://img.shields.io/badge/Readability-0284c7)</sub>
   
   <details>
     <summary>Tell me more</summary>
   
   ###### What is the issue?
   Class instance property 'hasLoggedLocalStorageUsage' is not initialized in 
the constructor.
   
   ###### Why this matters
   Initializing instance properties outside the constructor makes it harder to 
track the component's state and can lead to confusion about when the property 
is available.
   
   ###### Suggested change ∙ *Feature Preview*
   ```javascript
   constructor(props) {
     super(props);
     this.state = {
       hash: window.location.hash,
     };
     this.hasLoggedLocalStorageUsage = false;
   
     this.showLocalStorageUsageWarning = throttle(
       this.showLocalStorageUsageWarning,
       LOCALSTORAGE_WARNING_MESSAGE_THROTTLE_MS,
       { trailing: false },
     );
   }
   ```
   
   
   ###### Provide feedback to improve future suggestions
   [![Nice 
Catch](https://img.shields.io/badge/👍%20Nice%20Catch-71BC78)](https://app.korbit.ai/feedback/aa91ff46-6083-4491-9416-b83dd1994b51/82f3781b-ca7f-41fd-952d-65dd0837a591/upvote)
 
[![Incorrect](https://img.shields.io/badge/👎%20Incorrect-white)](https://app.korbit.ai/feedback/aa91ff46-6083-4491-9416-b83dd1994b51/82f3781b-ca7f-41fd-952d-65dd0837a591?what_not_true=true)
  [![Not in 
Scope](https://img.shields.io/badge/👎%20Out%20of%20PR%20scope-white)](https://app.korbit.ai/feedback/aa91ff46-6083-4491-9416-b83dd1994b51/82f3781b-ca7f-41fd-952d-65dd0837a591?what_out_of_scope=true)
 [![Not in coding 
standard](https://img.shields.io/badge/👎%20Not%20in%20our%20standards-white)](https://app.korbit.ai/feedback/aa91ff46-6083-4491-9416-b83dd1994b51/82f3781b-ca7f-41fd-952d-65dd0837a591?what_not_in_standard=true)
 
[![Other](https://img.shields.io/badge/👎%20Other-white)](https://app.korbit.ai/feedback/aa91ff46-6083-4491-9416-b83dd1994b51/82f3781b-ca7f-41fd-952d-65dd0837a591)
   </details>
   
   <sub>
   
   💬 Looking for more details? Reply to this comment to chat with Korbit.
   </sub>
   
   <!--- korbi internal id:086ef2b5-476d-443a-b3f6-00479d2effcf -->
   
   
   [](086ef2b5-476d-443a-b3f6-00479d2effcf)



##########
superset-frontend/plugins/legacy-plugin-chart-heatmap/src/transformProps.js:
##########
@@ -36,12 +42,30 @@ export default function transformProps(chartProps) {
     yscaleInterval,
     yAxisBounds,
     yAxisFormat,
+    timeFormat,
+    currencyFormat,
   } = formData;
-
+  const { data = [], coltypes = [] } = queriesData[0];

Review Comment:
   ### Unsafe Access of Column Types Array <sub>![category 
Functionality](https://img.shields.io/badge/Functionality-0284c7)</sub>
   
   <details>
     <summary>Tell me more</summary>
   
   ###### What is the issue?
   Assuming coltypes[0] and coltypes[1] exist for formatter selection may lead 
to runtime errors if the array is empty or has fewer elements.
   
   ###### Why this matters
   If coltypes array is empty or has less than 2 elements, accessing 
coltypes[0] or coltypes[1] for formatter selection could result in undefined 
being compared with GenericDataType.TEMPORAL, potentially causing unexpected 
behavior in data formatting.
   
   ###### Suggested change ∙ *Feature Preview*
   Add safety checks before accessing coltypes array indices:
   
   ```javascript
   const xAxisFormatter =
     coltypes?.[0] === GenericDataType.TEMPORAL
       ? getTimeFormatter(timeFormat)
       : String;
   const yAxisFormatter =
     coltypes?.[1] === GenericDataType.TEMPORAL
       ? getTimeFormatter(timeFormat)
       : String;
   ```
   
   
   ###### Provide feedback to improve future suggestions
   [![Nice 
Catch](https://img.shields.io/badge/👍%20Nice%20Catch-71BC78)](https://app.korbit.ai/feedback/aa91ff46-6083-4491-9416-b83dd1994b51/ce5845eb-7c52-4354-9cff-d7b5334a3538/upvote)
 
[![Incorrect](https://img.shields.io/badge/👎%20Incorrect-white)](https://app.korbit.ai/feedback/aa91ff46-6083-4491-9416-b83dd1994b51/ce5845eb-7c52-4354-9cff-d7b5334a3538?what_not_true=true)
  [![Not in 
Scope](https://img.shields.io/badge/👎%20Out%20of%20PR%20scope-white)](https://app.korbit.ai/feedback/aa91ff46-6083-4491-9416-b83dd1994b51/ce5845eb-7c52-4354-9cff-d7b5334a3538?what_out_of_scope=true)
 [![Not in coding 
standard](https://img.shields.io/badge/👎%20Not%20in%20our%20standards-white)](https://app.korbit.ai/feedback/aa91ff46-6083-4491-9416-b83dd1994b51/ce5845eb-7c52-4354-9cff-d7b5334a3538?what_not_in_standard=true)
 
[![Other](https://img.shields.io/badge/👎%20Other-white)](https://app.korbit.ai/feedback/aa91ff46-6083-4491-9416-b83dd1994b51/ce5845eb-7c52-4354-9cff-d7b5334a3538)
   </details>
   
   <sub>
   
   💬 Looking for more details? Reply to this comment to chat with Korbit.
   </sub>
   
   <!--- korbi internal id:4bf61b6c-bcb6-4177-b1b9-295ef1342681 -->
   
   
   [](4bf61b6c-bcb6-4177-b1b9-295ef1342681)



##########
superset-frontend/src/SqlLab/components/App/index.jsx:
##########
@@ -121,14 +124,27 @@ class App extends React.PureComponent {
   }
 
   componentDidUpdate() {
+    const { localStorageUsageInKilobytes, actions, queries } = this.props;
+    const queryCount = queries?.lenghth || 0;

Review Comment:
   ### Misspelled 'length' Property <sub>![category 
Readability](https://img.shields.io/badge/Readability-0284c7)</sub>
   
   <details>
     <summary>Tell me more</summary>
   
   ###### What is the issue?
   The variable 'length' is misspelled as 'lenghth' which could cause confusion 
and bugs.
   
   ###### Why this matters
   Misspelled property names in JavaScript silently return undefined, leading 
to unexpected behavior where the fallback value (0) is always used even when 
queries array exists.
   
   ###### Suggested change ∙ *Feature Preview*
   ```javascript
   const queryCount = queries?.length || 0;
   ```
   
   
   ###### Provide feedback to improve future suggestions
   [![Nice 
Catch](https://img.shields.io/badge/👍%20Nice%20Catch-71BC78)](https://app.korbit.ai/feedback/aa91ff46-6083-4491-9416-b83dd1994b51/35373107-5d7f-40a3-bcc6-46f60661b1c5/upvote)
 
[![Incorrect](https://img.shields.io/badge/👎%20Incorrect-white)](https://app.korbit.ai/feedback/aa91ff46-6083-4491-9416-b83dd1994b51/35373107-5d7f-40a3-bcc6-46f60661b1c5?what_not_true=true)
  [![Not in 
Scope](https://img.shields.io/badge/👎%20Out%20of%20PR%20scope-white)](https://app.korbit.ai/feedback/aa91ff46-6083-4491-9416-b83dd1994b51/35373107-5d7f-40a3-bcc6-46f60661b1c5?what_out_of_scope=true)
 [![Not in coding 
standard](https://img.shields.io/badge/👎%20Not%20in%20our%20standards-white)](https://app.korbit.ai/feedback/aa91ff46-6083-4491-9416-b83dd1994b51/35373107-5d7f-40a3-bcc6-46f60661b1c5?what_not_in_standard=true)
 
[![Other](https://img.shields.io/badge/👎%20Other-white)](https://app.korbit.ai/feedback/aa91ff46-6083-4491-9416-b83dd1994b51/35373107-5d7f-40a3-bcc6-46f60661b1c5)
   </details>
   
   <sub>
   
   💬 Looking for more details? Reply to this comment to chat with Korbit.
   </sub>
   
   <!--- korbi internal id:4c6b1311-27fd-48ea-b597-75a59aaab290 -->
   
   
   [](4c6b1311-27fd-48ea-b597-75a59aaab290)



##########
superset-frontend/src/SqlLab/components/App/index.jsx:
##########
@@ -121,14 +124,27 @@
   }
 
   componentDidUpdate() {
+    const { localStorageUsageInKilobytes, actions, queries } = this.props;
+    const queryCount = queries?.lenghth || 0;

Review Comment:
   ### Silent Failure Due to Property Typo <sub>![category Error 
Handling](https://img.shields.io/badge/Error%20Handling-ea580c)</sub>
   
   <details>
     <summary>Tell me more</summary>
   
   ###### What is the issue?
   The property 'lenghth' is misspelled (should be 'length') which could 
silently fail and return 0 due to the nullish coalescing operator, masking the 
actual error.
   
   ###### Why this matters
   This typo causes the code to always return 0 for queryCount when queries is 
defined, leading to incorrect logging and potentially hiding storage usage 
issues from administrators.
   
   ###### Suggested change ∙ *Feature Preview*
   ```javascript
   componentDidUpdate() {
       const { localStorageUsageInKilobytes, actions, queries } = this.props;
       const queryCount = queries?.length || 0;
   ```
   
   
   ###### Provide feedback to improve future suggestions
   [![Nice 
Catch](https://img.shields.io/badge/👍%20Nice%20Catch-71BC78)](https://app.korbit.ai/feedback/aa91ff46-6083-4491-9416-b83dd1994b51/09855c39-5b3b-48ee-94bf-628284ddf257/upvote)
 
[![Incorrect](https://img.shields.io/badge/👎%20Incorrect-white)](https://app.korbit.ai/feedback/aa91ff46-6083-4491-9416-b83dd1994b51/09855c39-5b3b-48ee-94bf-628284ddf257?what_not_true=true)
  [![Not in 
Scope](https://img.shields.io/badge/👎%20Out%20of%20PR%20scope-white)](https://app.korbit.ai/feedback/aa91ff46-6083-4491-9416-b83dd1994b51/09855c39-5b3b-48ee-94bf-628284ddf257?what_out_of_scope=true)
 [![Not in coding 
standard](https://img.shields.io/badge/👎%20Not%20in%20our%20standards-white)](https://app.korbit.ai/feedback/aa91ff46-6083-4491-9416-b83dd1994b51/09855c39-5b3b-48ee-94bf-628284ddf257?what_not_in_standard=true)
 
[![Other](https://img.shields.io/badge/👎%20Other-white)](https://app.korbit.ai/feedback/aa91ff46-6083-4491-9416-b83dd1994b51/09855c39-5b3b-48ee-94bf-628284ddf257)
   </details>
   
   <sub>
   
   💬 Looking for more details? Reply to this comment to chat with Korbit.
   </sub>
   
   <!--- korbi internal id:c914a8b4-9c3d-4187-b9b8-f0e28d53969a -->
   
   
   [](c914a8b4-9c3d-4187-b9b8-f0e28d53969a)



##########
superset-frontend/src/explore/components/controls/ColumnConfigControl/types.ts:
##########
@@ -44,14 +45,29 @@ export interface ColumnConfigInfo {
   config: JsonObject;
 }
 
+export type ControlFormItemDefaultSpec = ControlFormItemSpec<
+  keyof typeof ControlFormItemComponents
+>;
+
 export type ColumnConfigFormItem =
   | SharedColumnConfigProp
-  | { name: SharedColumnConfigProp; override: Partial<ControlFormItemSpec> }
-  | { name: string; config: ControlFormItemSpec };
+  | {
+      name: SharedColumnConfigProp;
+      override: Partial<ControlFormItemDefaultSpec>;
+    }
+  | { name: string; config: ControlFormItemDefaultSpec };
+
+export type TabLayoutItem = { tab: string; children: ColumnConfigFormItem[][] 
};
 
 export type ColumnConfigFormLayout = Record<
   GenericDataType,
-  ColumnConfigFormItem[][]
+  ColumnConfigFormItem[][] | TabLayoutItem[]
 >;
 
+export function isTabLayoutItem(
+  layoutItem: ColumnConfigFormItem[] | TabLayoutItem,
+): layoutItem is TabLayoutItem {
+  return !!(layoutItem as TabLayoutItem)?.tab;
+}

Review Comment:
   ### Incomplete Type Guard Validation <sub>![category 
Functionality](https://img.shields.io/badge/Functionality-0284c7)</sub>
   
   <details>
     <summary>Tell me more</summary>
   
   ###### What is the issue?
   The type guard function isTabLayoutItem could return a false positive when 
the 'tab' property exists but 'children' property is missing or invalid.
   
   ###### Why this matters
   If an object has a 'tab' property but lacks the required 'children' array 
property, the function will incorrectly identify it as a valid TabLayoutItem, 
potentially causing runtime errors when accessing the children property.
   
   ###### Suggested change ∙ *Feature Preview*
   ```typescript
   export function isTabLayoutItem(
     layoutItem: ColumnConfigFormItem[] | TabLayoutItem,
   ): layoutItem is TabLayoutItem {
     return !!(layoutItem as TabLayoutItem)?.tab && 
            Array.isArray((layoutItem as TabLayoutItem).children);
   }
   ```
   
   
   ###### Provide feedback to improve future suggestions
   [![Nice 
Catch](https://img.shields.io/badge/👍%20Nice%20Catch-71BC78)](https://app.korbit.ai/feedback/aa91ff46-6083-4491-9416-b83dd1994b51/b8219f57-e6de-4e5c-abd0-4b25b449c83f/upvote)
 
[![Incorrect](https://img.shields.io/badge/👎%20Incorrect-white)](https://app.korbit.ai/feedback/aa91ff46-6083-4491-9416-b83dd1994b51/b8219f57-e6de-4e5c-abd0-4b25b449c83f?what_not_true=true)
  [![Not in 
Scope](https://img.shields.io/badge/👎%20Out%20of%20PR%20scope-white)](https://app.korbit.ai/feedback/aa91ff46-6083-4491-9416-b83dd1994b51/b8219f57-e6de-4e5c-abd0-4b25b449c83f?what_out_of_scope=true)
 [![Not in coding 
standard](https://img.shields.io/badge/👎%20Not%20in%20our%20standards-white)](https://app.korbit.ai/feedback/aa91ff46-6083-4491-9416-b83dd1994b51/b8219f57-e6de-4e5c-abd0-4b25b449c83f?what_not_in_standard=true)
 
[![Other](https://img.shields.io/badge/👎%20Other-white)](https://app.korbit.ai/feedback/aa91ff46-6083-4491-9416-b83dd1994b51/b8219f57-e6de-4e5c-abd0-4b25b449c83f)
   </details>
   
   <sub>
   
   💬 Looking for more details? Reply to this comment to chat with Korbit.
   </sub>
   
   <!--- korbi internal id:f249b104-8504-4eb8-b807-629c89a9d8f7 -->
   
   
   [](f249b104-8504-4eb8-b807-629c89a9d8f7)



##########
superset-frontend/plugins/legacy-plugin-chart-heatmap/src/transformProps.js:
##########
@@ -16,8 +16,14 @@
  * specific language governing permissions and limitations
  * under the License.
  */
+import {
+  GenericDataType,
+  getTimeFormatter,
+  getValueFormatter,
+} from '@superset-ui/core';
+
 export default function transformProps(chartProps) {

Review Comment:
   ### Missing function documentation <sub>![category 
Documentation](https://img.shields.io/badge/Documentation-7c3aed)</sub>
   
   <details>
     <summary>Tell me more</summary>
   
   ###### What is the issue?
   The transformProps function lacks documentation explaining its purpose, 
expected input structure, and return value format.
   
   ###### Why this matters
   Without a clear understanding of the function's purpose and expected data 
structures, future developers will need to spend additional time understanding 
the code and may make incorrect assumptions.
   
   ###### Suggested change ∙ *Feature Preview*
   /**
    * Transforms chart properties into the data format required by the heatmap 
visualization.
    * @param {object} chartProps - Contains visualization settings including 
width, height, formData, queriesData, and datasource
    * @returns {object} Formatted properties for the heatmap chart including 
data formatters and display settings
    */
   
   
   ###### Provide feedback to improve future suggestions
   [![Nice 
Catch](https://img.shields.io/badge/👍%20Nice%20Catch-71BC78)](https://app.korbit.ai/feedback/aa91ff46-6083-4491-9416-b83dd1994b51/4167087b-3dcb-482d-aca7-17c5188c42ac/upvote)
 
[![Incorrect](https://img.shields.io/badge/👎%20Incorrect-white)](https://app.korbit.ai/feedback/aa91ff46-6083-4491-9416-b83dd1994b51/4167087b-3dcb-482d-aca7-17c5188c42ac?what_not_true=true)
  [![Not in 
Scope](https://img.shields.io/badge/👎%20Out%20of%20PR%20scope-white)](https://app.korbit.ai/feedback/aa91ff46-6083-4491-9416-b83dd1994b51/4167087b-3dcb-482d-aca7-17c5188c42ac?what_out_of_scope=true)
 [![Not in coding 
standard](https://img.shields.io/badge/👎%20Not%20in%20our%20standards-white)](https://app.korbit.ai/feedback/aa91ff46-6083-4491-9416-b83dd1994b51/4167087b-3dcb-482d-aca7-17c5188c42ac?what_not_in_standard=true)
 
[![Other](https://img.shields.io/badge/👎%20Other-white)](https://app.korbit.ai/feedback/aa91ff46-6083-4491-9416-b83dd1994b51/4167087b-3dcb-482d-aca7-17c5188c42ac)
   </details>
   
   <sub>
   
   💬 Looking for more details? Reply to this comment to chat with Korbit.
   </sub>
   
   <!--- korbi internal id:451a0eb3-ef89-48f1-a4ca-eee859b15280 -->
   
   
   [](451a0eb3-ef89-48f1-a4ca-eee859b15280)



##########
superset-frontend/src/explore/components/controls/ColumnConfigControl/ControlForm/ControlFormItem.tsx:
##########
@@ -87,20 +86,22 @@
       css={{
         margin: 2 * gridUnit,
         width,
+        maxWidth: '100%',
+        flex: 1,
       }}
       onMouseEnter={() => setHovered(true)}
       onMouseLeave={() => setHovered(false)}
     >
       {controlType === 'Checkbox' ? (
         <ControlFormItemComponents.Checkbox
-          checked={value as boolean}
+          value={value as boolean}
           onChange={handleChange}
-        >
-          {label}{' '}
-          {hovered && description && (
-            <InfoTooltipWithTrigger tooltip={description} />
-          )}
-        </ControlFormItemComponents.Checkbox>
+          name={name}
+          label={label}
+          description={description}
+          validationErrors={validationErrors}
+          {...props}
+        />

Review Comment:
   ### Checkbox Props Override Risk <sub>![category 
Functionality](https://img.shields.io/badge/Functionality-0284c7)</sub>
   
   <details>
     <summary>Tell me more</summary>
   
   ###### What is the issue?
   The Checkbox component receives both explicit props and spread props 
{...props}, which could lead to prop conflicts and unexpected behavior.
   
   ###### Why this matters
   Props specified explicitly could be overridden by the spread operator, 
potentially causing the checkbox to behave incorrectly.
   
   ###### Suggested change ∙ *Feature Preview*
   Reorder props to ensure explicit props take precedence:
   ```typescript
   <ControlFormItemComponents.Checkbox
     {...props}
     value={value as boolean}
     onChange={handleChange}
     name={name}
     label={label}
     description={description}
     validationErrors={validationErrors}
   />
   ```
   
   
   ###### Provide feedback to improve future suggestions
   [![Nice 
Catch](https://img.shields.io/badge/👍%20Nice%20Catch-71BC78)](https://app.korbit.ai/feedback/aa91ff46-6083-4491-9416-b83dd1994b51/fc224093-e628-422c-a53a-24e035a922f6/upvote)
 
[![Incorrect](https://img.shields.io/badge/👎%20Incorrect-white)](https://app.korbit.ai/feedback/aa91ff46-6083-4491-9416-b83dd1994b51/fc224093-e628-422c-a53a-24e035a922f6?what_not_true=true)
  [![Not in 
Scope](https://img.shields.io/badge/👎%20Out%20of%20PR%20scope-white)](https://app.korbit.ai/feedback/aa91ff46-6083-4491-9416-b83dd1994b51/fc224093-e628-422c-a53a-24e035a922f6?what_out_of_scope=true)
 [![Not in coding 
standard](https://img.shields.io/badge/👎%20Not%20in%20our%20standards-white)](https://app.korbit.ai/feedback/aa91ff46-6083-4491-9416-b83dd1994b51/fc224093-e628-422c-a53a-24e035a922f6?what_not_in_standard=true)
 
[![Other](https://img.shields.io/badge/👎%20Other-white)](https://app.korbit.ai/feedback/aa91ff46-6083-4491-9416-b83dd1994b51/fc224093-e628-422c-a53a-24e035a922f6)
   </details>
   
   <sub>
   
   💬 Looking for more details? Reply to this comment to chat with Korbit.
   </sub>
   
   <!--- korbi internal id:1ab53fba-4598-4d74-9c0c-3b82de51f62f -->
   
   
   [](1ab53fba-4598-4d74-9c0c-3b82de51f62f)



##########
superset-frontend/jest.config.js:
##########
@@ -17,6 +17,9 @@
  * under the License.
  */
 
+// timezone for unit tests
+process.env.TZ = 'America/New_York';

Review Comment:
   ### Insufficient timezone choice rationale <sub>![category 
Documentation](https://img.shields.io/badge/Documentation-7c3aed)</sub>
   
   <details>
     <summary>Tell me more</summary>
   
   ###### What is the issue?
   The comment is stating what the code does (setting timezone) but not 
explaining why America/New_York was specifically chosen as the timezone for 
tests.
   
   ###### Why this matters
   Without understanding the rationale for this specific timezone choice, 
future developers might change it without realizing potential impacts on test 
outcomes.
   
   ###### Suggested change ∙ *Feature Preview*
   // Use America/New_York timezone for consistent datetime-dependent test 
execution across different dev environments
   
   
   ###### Provide feedback to improve future suggestions
   [![Nice 
Catch](https://img.shields.io/badge/👍%20Nice%20Catch-71BC78)](https://app.korbit.ai/feedback/aa91ff46-6083-4491-9416-b83dd1994b51/3e70d196-43b8-49b3-9816-dfdba727bfa9/upvote)
 
[![Incorrect](https://img.shields.io/badge/👎%20Incorrect-white)](https://app.korbit.ai/feedback/aa91ff46-6083-4491-9416-b83dd1994b51/3e70d196-43b8-49b3-9816-dfdba727bfa9?what_not_true=true)
  [![Not in 
Scope](https://img.shields.io/badge/👎%20Out%20of%20PR%20scope-white)](https://app.korbit.ai/feedback/aa91ff46-6083-4491-9416-b83dd1994b51/3e70d196-43b8-49b3-9816-dfdba727bfa9?what_out_of_scope=true)
 [![Not in coding 
standard](https://img.shields.io/badge/👎%20Not%20in%20our%20standards-white)](https://app.korbit.ai/feedback/aa91ff46-6083-4491-9416-b83dd1994b51/3e70d196-43b8-49b3-9816-dfdba727bfa9?what_not_in_standard=true)
 
[![Other](https://img.shields.io/badge/👎%20Other-white)](https://app.korbit.ai/feedback/aa91ff46-6083-4491-9416-b83dd1994b51/3e70d196-43b8-49b3-9816-dfdba727bfa9)
   </details>
   
   <sub>
   
   💬 Looking for more details? Reply to this comment to chat with Korbit.
   </sub>
   
   <!--- korbi internal id:2a11d0c2-2194-4d2c-b543-8a78daf8481e -->
   
   
   [](2a11d0c2-2194-4d2c-b543-8a78daf8481e)



##########
superset-frontend/src/SqlLab/components/App/index.jsx:
##########
@@ -121,14 +124,27 @@
   }
 
   componentDidUpdate() {
+    const { localStorageUsageInKilobytes, actions, queries } = this.props;
+    const queryCount = queries?.lenghth || 0;
     if (
-      this.props.localStorageUsageInKilobytes >=
+      localStorageUsageInKilobytes >=
       LOCALSTORAGE_WARNING_THRESHOLD * LOCALSTORAGE_MAX_USAGE_KB
     ) {
       this.showLocalStorageUsageWarning(
-        this.props.localStorageUsageInKilobytes,
-        this.props.queries?.lenghth || 0,
+        localStorageUsageInKilobytes,
+        queryCount,
+      );
+    }
+    if (localStorageUsageInKilobytes > 0 && !this.hasLoggedLocalStorageUsage) {
+      const eventData = {
+        current_usage: localStorageUsageInKilobytes,
+        query_count: queryCount,
+      };
+      actions.logEvent(
+        LOG_ACTIONS_SQLLAB_MONITOR_LOCAL_STORAGE_USAGE,
+        eventData,
       );
+      this.hasLoggedLocalStorageUsage = true;
     }
   }

Review Comment:
   ### Method has multiple responsibilities <sub>![category 
Design](https://img.shields.io/badge/Design-0d9488)</sub>
   
   <details>
     <summary>Tell me more</summary>
   
   ###### What is the issue?
   The componentDidUpdate method contains two separate concerns: warning about 
storage usage and logging storage usage. This violates the Single 
Responsibility Principle.
   
   ###### Why this matters
   Having multiple responsibilities in a single method makes the code harder to 
maintain, test, and modify. Each responsibility should be handled by a separate 
method for better code organization and reusability.
   
   ###### Suggested change ∙ *Feature Preview*
   Extract the logging logic into a separate method:
   
   ```javascript
   componentDidUpdate() {
     this.checkAndWarnStorageUsage();
     this.logStorageUsageIfNeeded();
   }
   
   checkAndWarnStorageUsage() {
     const { localStorageUsageInKilobytes, queries } = this.props;
     const queryCount = queries?.length || 0;
     if (localStorageUsageInKilobytes >= LOCALSTORAGE_WARNING_THRESHOLD * 
LOCALSTORAGE_MAX_USAGE_KB) {
       this.showLocalStorageUsageWarning(localStorageUsageInKilobytes, 
queryCount);
     }
   }
   
   logStorageUsageIfNeeded() {
     const { localStorageUsageInKilobytes, actions, queries } = this.props;
     const queryCount = queries?.length || 0;
     if (localStorageUsageInKilobytes > 0 && !this.hasLoggedLocalStorageUsage) {
       actions.logEvent(LOG_ACTIONS_SQLLAB_MONITOR_LOCAL_STORAGE_USAGE, {
         current_usage: localStorageUsageInKilobytes,
         query_count: queryCount,
       });
       this.hasLoggedLocalStorageUsage = true;
     }
   }
   ```
   
   
   ###### Provide feedback to improve future suggestions
   [![Nice 
Catch](https://img.shields.io/badge/👍%20Nice%20Catch-71BC78)](https://app.korbit.ai/feedback/aa91ff46-6083-4491-9416-b83dd1994b51/147ef038-392b-4ad5-94db-60d5c7966082/upvote)
 
[![Incorrect](https://img.shields.io/badge/👎%20Incorrect-white)](https://app.korbit.ai/feedback/aa91ff46-6083-4491-9416-b83dd1994b51/147ef038-392b-4ad5-94db-60d5c7966082?what_not_true=true)
  [![Not in 
Scope](https://img.shields.io/badge/👎%20Out%20of%20PR%20scope-white)](https://app.korbit.ai/feedback/aa91ff46-6083-4491-9416-b83dd1994b51/147ef038-392b-4ad5-94db-60d5c7966082?what_out_of_scope=true)
 [![Not in coding 
standard](https://img.shields.io/badge/👎%20Not%20in%20our%20standards-white)](https://app.korbit.ai/feedback/aa91ff46-6083-4491-9416-b83dd1994b51/147ef038-392b-4ad5-94db-60d5c7966082?what_not_in_standard=true)
 
[![Other](https://img.shields.io/badge/👎%20Other-white)](https://app.korbit.ai/feedback/aa91ff46-6083-4491-9416-b83dd1994b51/147ef038-392b-4ad5-94db-60d5c7966082)
   </details>
   
   <sub>
   
   💬 Looking for more details? Reply to this comment to chat with Korbit.
   </sub>
   
   <!--- korbi internal id:3f3b33c9-d470-4808-bc80-d9e9d7bd6f8a -->
   
   
   [](3f3b33c9-d470-4808-bc80-d9e9d7bd6f8a)



##########
superset-frontend/src/explore/components/controls/ColumnConfigControl/ControlForm/ControlFormItem.tsx:
##########
@@ -70,7 +69,7 @@ export function ControlFormItem({
     const errors =
       (validators
         ?.map(validator =>
-          !required && isEmptyValue(fieldValue) ? false : 
validator(fieldValue),
+          isEmptyValue(fieldValue) ? false : validator(fieldValue),
         )
         .filter(x => !!x) as string[]) || [];

Review Comment:
   ### Incorrect Empty Value Validation Logic <sub>![category 
Functionality](https://img.shields.io/badge/Functionality-0284c7)</sub>
   
   <details>
     <summary>Tell me more</summary>
   
   ###### What is the issue?
   The validation logic skips all validators when the field value is empty, 
potentially bypassing required field validation.
   
   ###### Why this matters
   This could allow empty values to pass validation even when the field is 
required, leading to data integrity issues in the application.
   
   ###### Suggested change ∙ *Feature Preview*
   Modify the validation logic to consider the required status:
   ```typescript
   const errors =
     (validators
       ?.map(validator =>
         (props.required && isEmptyValue(fieldValue))
           ? 'This field is required'
           : validator(fieldValue)
       )
       .filter(x => !!x) as string[]) || [];
   ```
   
   
   ###### Provide feedback to improve future suggestions
   [![Nice 
Catch](https://img.shields.io/badge/👍%20Nice%20Catch-71BC78)](https://app.korbit.ai/feedback/aa91ff46-6083-4491-9416-b83dd1994b51/2c686e4f-3114-4a0d-b37c-70d908ec07f0/upvote)
 
[![Incorrect](https://img.shields.io/badge/👎%20Incorrect-white)](https://app.korbit.ai/feedback/aa91ff46-6083-4491-9416-b83dd1994b51/2c686e4f-3114-4a0d-b37c-70d908ec07f0?what_not_true=true)
  [![Not in 
Scope](https://img.shields.io/badge/👎%20Out%20of%20PR%20scope-white)](https://app.korbit.ai/feedback/aa91ff46-6083-4491-9416-b83dd1994b51/2c686e4f-3114-4a0d-b37c-70d908ec07f0?what_out_of_scope=true)
 [![Not in coding 
standard](https://img.shields.io/badge/👎%20Not%20in%20our%20standards-white)](https://app.korbit.ai/feedback/aa91ff46-6083-4491-9416-b83dd1994b51/2c686e4f-3114-4a0d-b37c-70d908ec07f0?what_not_in_standard=true)
 
[![Other](https://img.shields.io/badge/👎%20Other-white)](https://app.korbit.ai/feedback/aa91ff46-6083-4491-9416-b83dd1994b51/2c686e4f-3114-4a0d-b37c-70d908ec07f0)
   </details>
   
   <sub>
   
   💬 Looking for more details? Reply to this comment to chat with Korbit.
   </sub>
   
   <!--- korbi internal id:615de958-7cd1-420f-afbb-ac71300c0da2 -->
   
   
   [](615de958-7cd1-420f-afbb-ac71300c0da2)



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to