korbit-ai[bot] commented on code in PR #33172:
URL: https://github.com/apache/superset/pull/33172#discussion_r2049755319
##########
superset-frontend/plugins/plugin-chart-echarts/src/BigNumber/sharedControls.ts:
##########
@@ -129,5 +129,8 @@ export const subtitleControl: CustomControlItem = {
label: t('Subtitle'),
renderTrigger: true,
description: t('Description text that shows up below your Big Number'),
+ mapStateToProps: state => ({
+ value: state.form_data.subheader || state.form_data.subtitle,
+ }),
Review Comment:
### Fallback Logic Overrides Empty String <sub></sub>
<details>
<summary>Tell me more</summary>
###### What is the issue?
The logic might prioritize 'subheader' over 'subtitle' even when 'subtitle'
is intentionally set to an empty string.
###### Why this matters
If 'subtitle' is intentionally set to an empty string and 'subheader' has a
value, the empty string preference will be ignored, potentially displaying
unwanted text.
###### Suggested change ∙ *Feature Preview*
Consider using nullish coalescing operator to only fall back when the value
is null or undefined:
```typescript
mapStateToProps: state => ({
value: state.form_data.subtitle ?? state.form_data.subheader,
})
```
###### Provide feedback to improve future suggestions
[](https://app.korbit.ai/feedback/aa91ff46-6083-4491-9416-b83dd1994b51/20f2992b-e43b-4418-8270-c4e1503609ee/upvote)
[](https://app.korbit.ai/feedback/aa91ff46-6083-4491-9416-b83dd1994b51/20f2992b-e43b-4418-8270-c4e1503609ee?what_not_true=true)
[](https://app.korbit.ai/feedback/aa91ff46-6083-4491-9416-b83dd1994b51/20f2992b-e43b-4418-8270-c4e1503609ee?what_out_of_scope=true)
[](https://app.korbit.ai/feedback/aa91ff46-6083-4491-9416-b83dd1994b51/20f2992b-e43b-4418-8270-c4e1503609ee?what_not_in_standard=true)
[](https://app.korbit.ai/feedback/aa91ff46-6083-4491-9416-b83dd1994b51/20f2992b-e43b-4418-8270-c4e1503609ee)
</details>
<sub>
💬 Looking for more details? Reply to this comment to chat with Korbit.
</sub>
<!--- korbi internal id:f9508d01-4d71-4ea5-a74e-8261ef74f967 -->
[](f9508d01-4d71-4ea5-a74e-8261ef74f967)
--
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]