Skip to content

Commit aa0cae5

Browse files
authored
Merge pull request #1809 from keithclark/bug-1804
Fix duplication of parts when renaming them
2 parents e8f0025 + d0d6b36 commit aa0cae5

File tree

2 files changed

+5
-3
lines changed

2 files changed

+5
-3
lines changed

src/app/elements/kc-workspace-frame/kc-parts-controls.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -205,7 +205,7 @@ export class KCPartsControls extends LitElement {
205205
return this.renderRoot.querySelector(`#part-${id}`) as HTMLElement;
206206
}
207207
addEntry(model : IStackEntry) : IPartsControlsEntry {
208-
const item = model;
208+
let item = model;
209209
const entry : IPartsControlsEntry = {
210210
_onDidChangeName: new EventEmitter<string>(),
211211
get onDidChangeName() { return this._onDidChangeName.event },
@@ -214,6 +214,8 @@ export class KCPartsControls extends LitElement {
214214
const index = this.parts.indexOf(item);
215215
this.parts.splice(index, 1, model);
216216
this.parts = [...this.parts];
217+
item = model;
218+
item.entry = entry;
217219
},
218220
dispose: () => {
219221
item.inlineDisplay.onDispose();

src/app/lib/editor/toolbox.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -78,8 +78,8 @@ export class Toolbox extends Plugin {
7878
this.update();
7979
}
8080
updateEntry(oldEntry : IAPIDefinition, entry : IAPIDefinition) {
81-
const index = this.entries.indexOf(oldEntry);
82-
this.entries.splice(index, 1, entry);
81+
const index = this._entries.indexOf(oldEntry);
82+
this._entries.splice(index, 1, entry);
8383
this.update();
8484
}
8585
setWhitelist(whitelist : IToolboxWhitelist|null) {

0 commit comments

Comments
 (0)