kgabryje commented on code in PR #20107:
URL: https://github.com/apache/superset/pull/20107#discussion_r876875440
##########
superset-frontend/plugins/legacy-plugin-chart-event-flow/src/controlPanel.tsx:
##########
@@ -46,10 +47,8 @@ const config: ControlPanelConfig = {
choices: columnChoices(state?.datasource),
}),
// choices is from `mapStateToProps`
- default: (control: { choices?: string[] }) =>
- control.choices && control.choices.length > 0
- ? control.choices[0][0]
- : null,
+ default: (control: ControlState) =>
+ control.choices?.[0]?.[0] || null,
Review Comment:
How about `ensureIsArray(control.choices)[0][0]`? I'm actually not sure
which one is easier to read, up to you 🙂
--
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]