-
Notifications
You must be signed in to change notification settings - Fork 16.6k
refactor: convert controlUtils to TypeScript (2 of 2) #13520
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Large diffs are not rendered by default.
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -23,20 +23,6 @@ import { | |
| expandControlConfig, | ||
| } from '@superset-ui/chart-controls'; | ||
|
|
||
| const getMemoizedControlConfig = memoizeOne( | ||
| (controlKey, controlPanelConfig) => { | ||
| const { | ||
| controlOverrides = {}, | ||
| controlPanelSections = [], | ||
| } = controlPanelConfig; | ||
| const control = expandControlConfig( | ||
| findControlItem(controlPanelSections, controlKey), | ||
| controlOverrides, | ||
| ); | ||
| return control && 'config' in control ? control.config : control; | ||
| }, | ||
| ); | ||
|
|
||
| /** | ||
| * Find control item from control panel config. | ||
| */ | ||
|
|
@@ -59,6 +45,20 @@ export function findControlItem( | |
| ); | ||
| } | ||
|
|
||
| const getMemoizedControlConfig = memoizeOne( | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Is this one just changing location?
Member
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Yes, because ESLint complains function being used before definition. |
||
| (controlKey, controlPanelConfig) => { | ||
| const { | ||
| controlOverrides = {}, | ||
| controlPanelSections = [], | ||
| } = controlPanelConfig; | ||
| const control = expandControlConfig( | ||
| findControlItem(controlPanelSections, controlKey), | ||
| controlOverrides, | ||
| ); | ||
| return control && 'config' in control ? control.config : control; | ||
| }, | ||
| ); | ||
|
|
||
| export const getControlConfig = function getControlConfig( | ||
| controlKey: string, | ||
| vizType: string, | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could we do
let controlItem: CustomControlItem?There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Unfortunately no, because
findControlItemmay also returnnullorReactElement. Using simple type declaration will throw an error: