Skip to content

Commit b3b0d69

Browse files
authored
fix(bit-server), reload staged-snaps after export (#9320)
to avoid `ENOENT` error during `bit lane merge`.
1 parent 1655e7c commit b3b0d69

File tree

2 files changed

+6
-0
lines changed

2 files changed

+6
-0
lines changed

scopes/harmony/ipc-events/ipc-events.main.runtime.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,9 @@ export class IpcEventsMain {
7979
});
8080
ipcEventsMain.registerGotEventSlot(async (eventName) => {
8181
if (eventName === 'onPostObjectsPersist') {
82+
logger.debug('got an event onPostObjectsPersist, clearing the cache and reloading staged-snaps');
8283
scope.legacyScope.objects.clearObjectsFromCache();
84+
scope.legacyScope.setStagedSnaps(); // "bit export" deletes the staged-snaps file, so it should be reloaded
8385
}
8486
});
8587
}

src/scope/scope.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -143,6 +143,10 @@ export default class Scope {
143143
this.lanes = new Lanes(this.objects, this.scopeJson);
144144
this.isBare = scopeProps.isBare ?? false;
145145
this.scopeImporter = ScopeComponentsImporter.getInstance(this);
146+
this.setStagedSnaps();
147+
}
148+
149+
setStagedSnaps() {
146150
this.stagedSnaps = StagedSnaps.load(this.path);
147151
}
148152

0 commit comments

Comments
 (0)