diff --git a/app/server/appsmith-server/src/main/java/com/appsmith/server/newactions/refactors/NewActionRefactoringServiceCEImpl.java b/app/server/appsmith-server/src/main/java/com/appsmith/server/newactions/refactors/NewActionRefactoringServiceCEImpl.java index 3b1835772a..aeeb26b15f 100644 --- a/app/server/appsmith-server/src/main/java/com/appsmith/server/newactions/refactors/NewActionRefactoringServiceCEImpl.java +++ b/app/server/appsmith-server/src/main/java/com/appsmith/server/newactions/refactors/NewActionRefactoringServiceCEImpl.java @@ -114,14 +114,15 @@ public class NewActionRefactoringServiceCEImpl implements EntityRefactoringServi @Override public Mono updateRefactoredEntity(RefactorEntityNameDTO refactorEntityNameDTO, String branchName) { return newActionService - .findActionDTObyIdAndViewMode( - refactorEntityNameDTO.getActionId(), false, actionPermission.getEditPermission()) + .findByBranchNameAndDefaultActionId( + branchName, refactorEntityNameDTO.getActionId(), actionPermission.getEditPermission()) + .flatMap(branchedAction -> newActionService.generateActionByViewMode(branchedAction, false)) .flatMap(action -> { action.setName(refactorEntityNameDTO.getNewName()); if (StringUtils.hasLength(refactorEntityNameDTO.getCollectionName())) { action.setFullyQualifiedName(refactorEntityNameDTO.getNewFullyQualifiedName()); } - return newActionService.updateUnpublishedAction(refactorEntityNameDTO.getActionId(), action); + return newActionService.updateUnpublishedAction(action.getId(), action); }) .then(); }