appsmith icon indicating copy to clipboard operation
appsmith copied to clipboard

fix: Refactor entities with specific rules

Open nidhi-nair opened this issue 3 years ago • 6 comments
trafficstars

Description

This PR introduces more intelligence in the way we parse the DSL, actions and JS Objects during the refactor flow. Earlier, we used to treat each of these objects as plain maps that needed to be walked and performed a string replacement at any location where we found a match with the old name that was being refactored. However, this caused a few problems like ending up refactoring texts in the DSL that was not a binding but just happened to share the same keyword. Examples of these are when table names happened to have the same name as a widget name that is being refactored.

In this PR, we now only look at very specific paths in each type of object:

  1. For DSL:
    • Only look at widgets
    • Specifically look at widget names
    • Parse through paths identified to contain dynamic bindings or dynamic triggers
    • In case of list, also look at templates
  2. For actions:
    • Parse through paths identified to contain dynamic bindings or dynamic triggers
  3. For JS Objects:
    • For an JS function that has been refactored, also update the complete body string for that action collection

Fixes #6760

Type of change

  • Bug fix (non-breaking change which fixes an issue)

How Has This Been Tested?

  • Manual testing
  • JUnit tests

Checklist:

  • [x] My code follows the style guidelines of this project
  • [x] I have performed a self-review of my own code
  • [x] 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
  • [x] I have added tests that prove my fix is effective or that my feature works
  • [x] New and existing unit tests pass locally with my changes

nidhi-nair avatar Oct 12 '22 16:10 nidhi-nair

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

Name Status Preview Updated
appsmith ✅ Ready (Inspect) Visit Preview Oct 20, 2022 at 6:05PM (UTC)

vercel[bot] avatar Oct 12 '22 16:10 vercel[bot]

Deployment failed with the following error:

Resource is limited - try again in 27 minutes (more than 100, code: "api-deployments-free-per-day").

vercel[bot] avatar Oct 18 '22 01:10 vercel[bot]

Deployment failed with the following error:

Resource is limited - try again in 29 minutes (more than 100, code: "api-deployments-free-per-day").

vercel[bot] avatar Oct 19 '22 04:10 vercel[bot]

Deployment failed with the following error:

Resource is limited - try again in 8 minutes (more than 100, code: "api-deployments-free-per-day").

vercel[bot] avatar Oct 19 '22 09:10 vercel[bot]

/ok-to-test sha=21964bb

ChandanBalajiBP avatar Oct 20 '22 10:10 ChandanBalajiBP

Tests running at: https://github.com/appsmithorg/appsmith/actions/runs/3288919659. Workflow: Appsmith External Integration Test Workflow. Commit: 21964bb. PR: 17523. Perf tests will be available at https://app.appsmith.com/app/performance-infra-dashboard/pr-details-63465d4789020c7ac296d08d?pr=17523&runId=3288919659_1

github-actions[bot] avatar Oct 20 '22 11:10 github-actions[bot]