appsmith icon indicating copy to clipboard operation
appsmith copied to clipboard

[Fix]: Only first occurrence is renamed in AST-based entity refactor

Open ChandanBalajiBP opened this issue 3 years ago • 0 comments

Is there an existing issue for this?

  • [X] I have searched the existing issues

Description

Only the first occurrence of the old name is refactored and the rest all are remains as it is. Sample inputs:

{
    "script": "Text1.text + Text1.text",
    "oldName": "Text1",
    "newName": "Text1234",
    "evalVersion": 2,
    "isJSObject": false
}
{
    "script": "export default {\n\tmyVar1: [],\n\tmyVar2: {},\n\tmyFun1: () => {\n\t\t//write code here\n\t\t// Text1.text\n\t\treturn \"Text1.text\" + Text1.text\n\t},\n\tmyFun2: async () => {\n\t\t//use async-await or promises\n\t\t// Text1.text\n\t\treturn \"Text1.text\" + Text1.text\n\t}\n}",
    "oldName": "Text1",
    "newName": "Text1234",
    "evalVersion": 2,
    "isJSObject": true
}

Steps To Reproduce

Hit RTS on this API rts-api/v1/ast/entity-refactor (POST request) with the above data in body

Public Sample App

No response

Issue video log

No response

Version

Cloud

ChandanBalajiBP avatar Dec 05 '22 13:12 ChandanBalajiBP