Skip to content
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

Closed
wants to merge 12 commits into from
Closed

Conversation

Rohit1508
Copy link
Contributor

No description provided.

this.chartModel,
payload.visualProps,
payload.chartConfigEditorDefinition,
);
Copy link
Contributor

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

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

done

Copy link

github-actions bot commented Feb 26, 2024

File Coverage
All files 85%
src/index.ts 0%
src/main/custom-chart-context.ts 86%
src/main/post-message-event-bridge.ts 96%
src/react/use-custom-chart-context.tsx 83%
src/react/mocks/custom-chart-context-mock.ts 76%

Minimum allowed coverage is 0%

Generated by 🐒 cobertura-action against 2f0bf60

import {
ChartConfigEditorDefinition,
ConfigEditorDefinitionSetter,
} from '../types/configurator.types';
Copy link
Contributor

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.

* @param {VisualProps}
* @returns {ChartConfigEditorDefinition[]}
*/
public getChartConfigEditorDefinition = ({
Copy link
Contributor

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.

* @param {VisualProps}
* @returns {VisualPropEditorDefinition}
*/
public getVisualPropEditorDefinition = ({
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

same as above.

if (validationResponse.isValid) {
const updatedState = {
updatedChartConfig:
this.chartModel.config?.chartConfig,
Copy link
Contributor

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.

Copy link
Contributor Author

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

Copy link
Contributor Author

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

if (validationResponse.isValid) {
const updatedState = {
updatedChartConfig: payload.chartConfig,
updatedVisualProps: this.chartModel?.visualProps,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this should be empty.

Copy link
Contributor Author

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.

@@ -776,13 +864,21 @@ export class CustomChartContext {
this.chartModel,
);
}
const defaultState = {
Copy link
Contributor

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.

@Rohit1508 Rohit1508 closed this Mar 28, 2024
@Rohit1508 Rohit1508 deleted the dynamic_config_poc branch March 28, 2024 12:33
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants