diff --git a/packages/integration/src/lib/search/search.state.ts b/packages/integration/src/lib/search/search.state.ts index 8c3766d9a..0c1722dee 100644 --- a/packages/integration/src/lib/search/search.state.ts +++ b/packages/integration/src/lib/search/search.state.ts @@ -124,14 +124,16 @@ export class SearchState { const wksSource = this.searchSourceService .getSources() .find((source) => source.getId() === 'workspace'); - this.workspaceState.store.entities$.subscribe((e) => { - const searchableWks = e.filter( - (fw) => - fw instanceof FeatureWorkspace && - fw.layer.options.workspace.searchIndexEnabled - ); - this.searchSourceService.setWorkspaces(wksSource, searchableWks); - }); + if (wksSource) { + this.workspaceState.store.entities$.subscribe((e) => { + const searchableWks = e.filter( + (fw) => + fw instanceof FeatureWorkspace && + fw.layer.options.workspace.searchIndexEnabled + ); + this.searchSourceService.setWorkspaces(wksSource, searchableWks); + }); + } this.monitorLayerDeletion(); }