-
Notifications
You must be signed in to change notification settings - Fork 4
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
Dynamic config + visual props POC #26
Conversation
src/main/custom-chart-context.ts
Outdated
this.chartModel, | ||
payload.visualProps, | ||
payload.chartConfigEditorDefinition, | ||
); |
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.
this can also change the configEditorDefinition
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.
done
Minimum allowed coverage is Generated by 🐒 cobertura-action against 2f0bf60 |
import { | ||
ChartConfigEditorDefinition, | ||
ConfigEditorDefinitionSetter, | ||
} from '../types/configurator.types'; |
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.
I think there is dependency cycle issue due to the imports that we have.
Please resolve this.
Also would be good to add dependency cycle lint in the current codebase.
src/main/custom-chart-context.ts
Outdated
* @param {VisualProps} | ||
* @returns {ChartConfigEditorDefinition[]} | ||
*/ | ||
public getChartConfigEditorDefinition = ({ |
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.
This cannot be public function.
src/main/custom-chart-context.ts
Outdated
* @param {VisualProps} | ||
* @returns {VisualPropEditorDefinition} | ||
*/ | ||
public getVisualPropEditorDefinition = ({ |
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.
same as above.
src/main/custom-chart-context.ts
Outdated
if (validationResponse.isValid) { | ||
const updatedState = { | ||
updatedChartConfig: | ||
this.chartModel.config?.chartConfig, |
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.
This should be empty as this has not changed.
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.
But for getting latest definition we need to pass both visual props as well as chart config
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.
Its good to pass both chartConfig as well as visual props for fetching the definition because either it is visual update or config update, we are trigerring the setter for both config definition and visual definition. It would be unnecessary confusion for user while defining the definition function that which one to prefer(visual props from arg or from ctx).
Will change the naming convention here for better understanding
src/main/custom-chart-context.ts
Outdated
if (validationResponse.isValid) { | ||
const updatedState = { | ||
updatedChartConfig: payload.chartConfig, | ||
updatedVisualProps: this.chartModel?.visualProps, |
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.
this should be empty.
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.
for getting latest definition we need to pass both visual props as well as chart config.
User can extract visualProps
here from ctx but if we pass it explicitly it would be more convenient for dev.
src/main/custom-chart-context.ts
Outdated
@@ -776,13 +864,21 @@ export class CustomChartContext { | |||
this.chartModel, | |||
); | |||
} | |||
const defaultState = { |
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.
we should only send this when these are updated.
No description provided.