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

refactor: JSONForm eliminate the use of canvasWidgets and remove childStylesheet from dynamicBindingPathList #18715

Merged
merged 6 commits into from
Dec 12, 2022

Conversation

ashit-rath
Copy link
Contributor

@ashit-rath ashit-rath commented Dec 6, 2022

Description

TL;DR
This refactors some of the code for JSONForm widget, which helps it work along with the upcoming List v2.0. It also contains some changes to theming's internal working which may improve some performance (very minor) but it originally spawned because of the first refactor.

This PR comprises 2 refactors.
The JSONForm used canvasWidgets directly to get the uneval schema and uneval childStylesheet as it used both to generate the next schema.

How are both the problems eliminated:

  1. uneval schema
    Instead of taking the old schema and overwriting the modified/added/deleted bits to it, the schema parser now only generates the first schema if not present and post that the parser provides paths of the properties that got deleted and the modifed/added paths with value. It still returns the amended schema using the prev but it's not used anymore. The paths that are returned are then directly used to update using the batchUpdateWidgetProperty. We realised that when something is modified or added to the source data, fresh config is always generated to old config was not in play so uneval old schema was not need anymore.

  2. uneval childStylesheet
    The reason for getting evaluated childStylesheet was when a new widget was dropped, the paths of childStylesheet was automatically added the the dynamicBindingPathList. This lead to the the property to come always in the evaluated form.
    This was fixed along with a migration that removes all the widgets where the paths are added to the dynamicBindingPathList.

Fixes #16616

Note to QA

This PR does not contain any bug/feature and should not introduce any regression .

  • This PR requires a full regression of the JSONForm
  • Theming aspects of the JSONForm, Table widget and the Button Group widget needs to tested as well
  • This PR contains a migration, post migration nothing new is introduced. Only internal properties are modified so everything should work as is.

Type of change

  • Refactor (non-breaking change which fixes an issue)

How Has This Been Tested?

  • Jest test
    • for the migration
    • for the schema parser

Test Plan

Add Testsmith test cases links that relate to this PR

Issues raised during DP testing

Link issues raised during DP testing for better visiblity and tracking (copy link from comments dropped on this PR)

Checklist:

Dev activity

  • My code follows the style guidelines of this project
  • I have performed a self-review of my own code
  • I have commented my code, particularly in hard-to-understand areas
  • I have made corresponding changes to the documentation
  • My changes generate no new warnings
  • I have added tests that prove my fix is effective or that my feature works
  • New and existing unit tests pass locally with my changes
  • PR is being merged under a feature flag

QA activity:

  • Test plan has been approved by relevant developers
  • Test plan has been peer reviewed by QA
  • Cypress test cases have been added and approved by either SDET or manual QA
  • Organized project review call with relevant stakeholders after Round 1/2 of QA
  • Added Test Plan Approved label after reveiwing all Cypress test

@vercel
Copy link

vercel bot commented Dec 6, 2022

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Updated
appsmith ✅ Ready (Inspect) Visit Preview Dec 9, 2022 at 3:41AM (UTC)

@github-actions github-actions bot added App Viewers Pod This label assigns issues to the app viewers pod JSON Form Issue / features related to the JSON form wiget List Widget Issues related to the list widget Low An issue that is neither critical nor breaks a user flow labels Dec 6, 2022
@ashit-rath
Copy link
Contributor Author

/ok-to-test sha=064f810

@github-actions
Copy link

github-actions bot commented Dec 6, 2022

Tests running at: https://github.com/appsmithorg/appsmith/actions/runs/3627534023.
Workflow: Appsmith External Integration Test Workflow.
Commit: 064f810.
PR: 18715.
Perf tests will be available at https://app.appsmith.com/app/performance-infra-dashboard/pr-details-638dd7cd2913ba43778b915e?pr=18715&runId=3627534023_1

@@ -612,3 +613,31 @@ export const addPropertyToDynamicPropertyPathList = (
];
}
};

export const migrateChildStylesheetFromDynamicBindingPathList = (
currentDSL: DSLWidget,
Copy link
Contributor

Choose a reason for hiding this comment

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

Could you have a look at this utility we wrote to simplify the migration codes traverseDSLAndMigrate

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Ohh nice, I was looking for something like this.

@ashit-rath
Copy link
Contributor Author

/ok-to-test sha=2d09a9d

@github-actions
Copy link

github-actions bot commented Dec 7, 2022

Tests running at: https://github.com/appsmithorg/appsmith/actions/runs/3635935335.
Workflow: Appsmith External Integration Test Workflow.
Commit: 2d09a9d.
PR: 18715.
Perf tests will be available at https://app.appsmith.com/app/performance-infra-dashboard/pr-details-638dd7cd2913ba43778b915e?pr=18715&runId=3635935335_1

sbalaji1192
sbalaji1192 previously approved these changes Dec 7, 2022
@ashit-rath
Copy link
Contributor Author

/ok-to-test sha=0001842

@ashit-rath
Copy link
Contributor Author

/ok-to-test sha=0001842

@github-actions
Copy link

github-actions bot commented Dec 7, 2022

Tests running at: https://github.com/appsmithorg/appsmith/actions/runs/3638307458.
Workflow: Appsmith External Integration Test Workflow.
Commit: 0001842.
PR: 18715.
Perf tests will be available at https://app.appsmith.com/app/performance-infra-dashboard/pr-details-638dd7cd2913ba43778b915e?pr=18715&runId=3638307458_1

@ashit-rath
Copy link
Contributor Author

/ok-to-test sha=37d454f

@github-actions
Copy link

github-actions bot commented Dec 8, 2022

Tests running at: https://github.com/appsmithorg/appsmith/actions/runs/3645779329.
Workflow: Appsmith External Integration Test Workflow.
Commit: 37d454f.
PR: 18715.
Perf tests will be available at https://app.appsmith.com/app/performance-infra-dashboard/pr-details-638dd7cd2913ba43778b915e?pr=18715&runId=3645779329_1

@ashit-rath
Copy link
Contributor Author

/ok-to-test sha=d4e6115

@github-actions
Copy link

github-actions bot commented Dec 8, 2022

Tests running at: https://github.com/appsmithorg/appsmith/actions/runs/3648067597.
Workflow: Appsmith External Integration Test Workflow.
Commit: d4e6115.
PR: 18715.
Perf tests will be available at https://app.appsmith.com/app/performance-infra-dashboard/pr-details-638dd7cd2913ba43778b915e?pr=18715&runId=3648067597_1

@ashit-rath
Copy link
Contributor Author

/ok-to-test sha=7cedc8c

@github-actions
Copy link

github-actions bot commented Dec 9, 2022

Tests running at: https://github.com/appsmithorg/appsmith/actions/runs/3654223858.
Workflow: Appsmith External Integration Test Workflow.
Commit: 7cedc8c.
PR: 18715.
Perf tests will be available at https://app.appsmith.com/app/performance-infra-dashboard/pr-details-638dd7cd2913ba43778b915e?pr=18715&runId=3654223858_1

@chandannkumar
Copy link

Tested this PR and LGTM

  • Regression on JSONForm widget
  • Regression on Table, Button group widget related to theming aspects

@ashit-rath ashit-rath merged commit f67f857 into release Dec 12, 2022
@ashit-rath ashit-rath deleted the fix/jsonform-canvas-refactor branch December 12, 2022 04:43
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
App Viewers Pod This label assigns issues to the app viewers pod JSON Form Issue / features related to the JSON form wiget List Widget Issues related to the list widget Low An issue that is neither critical nor breaks a user flow
Projects
None yet
Development

Successfully merging this pull request may close these issues.

JSONForm Widget crashes inside List widget
3 participants