Skip to content

Commit

Permalink
watch catalog file even if non existing, to be able to detect new file (
Browse files Browse the repository at this point in the history
  • Loading branch information
feloy authored Jan 19, 2024
1 parent bf1ee55 commit fdc085b
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions packages/backend/src/managers/catalogManager.ts
Original file line number Diff line number Diff line change
Expand Up @@ -59,16 +59,17 @@ export class CatalogManager {

async loadCatalog() {
const catalogPath = path.resolve(this.appUserDirectory, 'catalog.json');
if (!existsSync(catalogPath)) {
return this.setCatalog(defaultCatalog);
}

try {
this.watchCatalogFile(catalogPath); // do not await, we want to do this async
} catch (err: unknown) {
console.error(`unable to watch catalog file, changes to the catalog file won't be reflected to the UI`, err);
}

if (!existsSync(catalogPath)) {
return this.setCatalog(defaultCatalog);
}

try {
const cat = await this.readAndAnalyzeCatalog(catalogPath);
return this.setCatalog(cat);
Expand Down

0 comments on commit fdc085b

Please sign in to comment.