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


##########
superset-frontend/plugins/plugin-chart-table/src/buildQuery.ts:
##########
@@ -116,6 +116,10 @@ const buildQuery: BuildQuery<TableChartFormData> = (
       }
     }
 
+    if (extra_form_data?.time_compare) {
+      timeOffsets = [extra_form_data.time_compare];
+    }

Review Comment:
   ### Time Compare Override Obliterates Existing Time Shifts <sub>![category 
Functionality](https://img.shields.io/badge/Functionality-0284c7)</sub>
   
   <details>
     <summary>Tell me more</summary>
   
   ###### What is the issue?
   The code overwrites any previously set timeOffsets without considering 
existing non-custom and custom time shifts.
   
   
   ###### Why this matters
   This can lead to loss of time comparison functionality when both regular 
time_compare and extra_form_data.time_compare are present, as the latter 
completely replaces all previous time shift configurations.
   
   ###### Suggested change ∙ *Feature Preview*
   Modify the code to conditionally append the extra time compare instead of 
replacing:
   ```typescript
   if (extra_form_data?.time_compare) {
     if (!timeOffsets.includes(extra_form_data.time_compare)) {
       timeOffsets.push(extra_form_data.time_compare);
     }
   }
   ```
   
   
   ###### 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/2acf238d-e630-45cb-87ed-4c6d1105024e/upvote)
 
[![Incorrect](https://img.shields.io/badge/👎%20Incorrect-white)](https://app.korbit.ai/feedback/aa91ff46-6083-4491-9416-b83dd1994b51/2acf238d-e630-45cb-87ed-4c6d1105024e?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/2acf238d-e630-45cb-87ed-4c6d1105024e?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/2acf238d-e630-45cb-87ed-4c6d1105024e?what_not_in_standard=true)
 
[![Other](https://img.shields.io/badge/👎%20Other-white)](https://app.korbit.ai/feedback/aa91ff46-6083-4491-9416-b83dd1994b51/2acf238d-e630-45cb-87ed-4c6d1105024e)
   </details>
   
   <sub>
   
   💬 Looking for more details? Reply to this comment to chat with Korbit.
   </sub>
   
   <!--- korbi internal id:33d6c05e-1a1e-43a5-afc9-3ecdbd4b8e8b -->
   
   
   [](33d6c05e-1a1e-43a5-afc9-3ecdbd4b8e8b)



-- 
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