From 6050df83414152b344195c102d0e71cf1bde1a60 Mon Sep 17 00:00:00 2001 From: kumavis Date: Fri, 1 Dec 2023 11:03:34 -1000 Subject: [PATCH] fix(daemon): pet-store removes petname when overwriting with write --- packages/daemon/src/pet-store.js | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/packages/daemon/src/pet-store.js b/packages/daemon/src/pet-store.js index dea68ae808..8e2da048e8 100644 --- a/packages/daemon/src/pet-store.js +++ b/packages/daemon/src/pet-store.js @@ -83,6 +83,15 @@ export const makePetStoreMaker = (filePowers, locator) => { throw new Error(`Invalid formula identifier ${q(formulaIdentifier)}`); } + if (petNames.has(petName)) { + // Perform cleanup on the overwritten pet name. + const formulaPetNames = formulaIdentifiers.get(petName); + if (formulaPetNames !== undefined) { + formulaPetNames.delete(petName); + } + changesTopic.publisher.next({ remove: petName }); + } + petNames.set(petName, formulaIdentifier); const formulaPetNames = formulaIdentifiers.get(formulaIdentifier);