Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
fix(sdk): don't duplicate entries in project explorer when renaming
apparently deleting from object using ?. expression is somehow badly transformed during optimizations pass
  • Loading branch information
nihonium-cfx committed Feb 11, 2022
1 parent 88276d4 commit 185cbc7
Showing 1 changed file with 7 additions and 2 deletions.
Expand Up @@ -51,8 +51,13 @@ export class ProjectFsState implements IDisposableObject {
const oldParentFsEntry = this.getFsEntry(update.oldParentPath);
const newParentFsEntry = this.getFsEntry(update.newParentPath);

const oldFsEntry = oldParentFsEntry?.children[update.oldName];
delete oldParentFsEntry?.children[update.oldName];
if (!oldParentFsEntry) {
console.error('Unable to perform rename, no parent fs entry', { update, oldParentFsEntry, newParentFsEntry });
break;
}

const oldFsEntry = oldParentFsEntry.children[update.oldName];
delete oldParentFsEntry.children[update.oldName];

if (oldFsEntry && newParentFsEntry) {
oldFsEntry.name = update.newName;
Expand Down

0 comments on commit 185cbc7

Please sign in to comment.