korbit-ai[bot] commented on code in PR #34589:
URL: https://github.com/apache/superset/pull/34589#discussion_r2259255650
##########
superset-frontend/plugins/plugin-chart-echarts/src/controls.tsx:
##########
@@ -163,13 +198,17 @@ export const percentageThresholdControl: ControlSetItem =
{
export const showValueSection: ControlSetRow[] = [
[showValueControl],
+ [distanceValueControl],
+ [rotateValueControl],
[stackControl],
[onlyTotalControl],
[percentageThresholdControl],
];
export const showValueSectionWithoutStack: ControlSetRow[] = [
[showValueControl],
+ [distanceValueControl],
+ [rotateValueControl],
[onlyTotalControl],
];
Review Comment:
### Duplicated Value Section Controls <sub></sub>
<details>
<summary>Tell me more</summary>
###### What is the issue?
There is code duplication between showValueSection and
showValueSectionWithoutStack where the value-related controls are repeated.
###### Why this matters
Code duplication violates the DRY principle and makes maintenance more
difficult as changes need to be made in multiple places.
###### Suggested change ∙ *Feature Preview*
Extract common controls into a shared array and compose the sections:
```typescript
const commonValueControls = [
[showValueControl],
[distanceValueControl],
[rotateValueControl],
];
export const showValueSection = [
...commonValueControls,
[stackControl],
[onlyTotalControl],
[percentageThresholdControl],
];
export const showValueSectionWithoutStack = [
...commonValueControls,
[onlyTotalControl],
];
```
###### Provide feedback to improve future suggestions
[](https://app.korbit.ai/feedback/aa91ff46-6083-4491-9416-b83dd1994b51/4d8d68f9-7516-4f22-a7b4-3a50c834de59/upvote)
[](https://app.korbit.ai/feedback/aa91ff46-6083-4491-9416-b83dd1994b51/4d8d68f9-7516-4f22-a7b4-3a50c834de59?what_not_true=true)
[](https://app.korbit.ai/feedback/aa91ff46-6083-4491-9416-b83dd1994b51/4d8d68f9-7516-4f22-a7b4-3a50c834de59?what_out_of_scope=true)
[](https://app.korbit.ai/feedback/aa91ff46-6083-4491-9416-b83dd1994b51/4d8d68f9-7516-4f22-a7b4-3a50c834de59?what_not_in_standard=true)
[](https://app.korbit.ai/feedback/aa91ff46-6083-4491-9416-b83dd1994b51/4d8d68f9-7516-4f22-a7b4-3a50c834de59)
</details>
<sub>
💬 Looking for more details? Reply to this comment to chat with Korbit.
</sub>
<!--- korbi internal id:d36aa9b9-8439-4314-9231-80704bb92cfe -->
[](d36aa9b9-8439-4314-9231-80704bb92cfe)
--
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]