Skip to content

Commit

Permalink
fix: resource selection after renaming
Browse files Browse the repository at this point in the history
  • Loading branch information
devcatalin committed Sep 10, 2021
1 parent 06c8ab8 commit 7ae5b21
Showing 1 changed file with 16 additions and 3 deletions.
19 changes: 16 additions & 3 deletions src/redux/services/renameResource.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,8 @@ export const renameResource = (
newResourceName: string,
shouldUpdateRefs: boolean,
resourceMap: ResourceMapType,
dispatch: AppDispatch
dispatch: AppDispatch,
selectedResourceId?: string
) => {
const resource = resourceMap[resourceId];
if (!resource || !resource.content) {
Expand Down Expand Up @@ -41,8 +42,20 @@ export const renameResource = (
}
newDependentResourceText += `${line.replace(ref.name, newResourceName)}\n`;
});
dispatch(updateResource({resourceId: dependentResource.id, content: newDependentResourceText}));
dispatch(
updateResource({
resourceId: dependentResource.id,
content: newDependentResourceText,
preventSelectionAndHighlightsUpdate: selectedResourceId !== dependentResource.id,
})
);
});
}
dispatch(updateResource({resourceId, content: newResourceText}));
dispatch(
updateResource({
resourceId,
content: newResourceText,
preventSelectionAndHighlightsUpdate: selectedResourceId !== resourceId,
})
);
};

0 comments on commit 7ae5b21

Please sign in to comment.