diff --git a/apps/browser/src/background/main.background.ts b/apps/browser/src/background/main.background.ts index bbcb9f9628..0e43f420ab 100644 --- a/apps/browser/src/background/main.background.ts +++ b/apps/browser/src/background/main.background.ts @@ -1181,13 +1181,8 @@ export default class MainBackground { //Needs to be checked before state is cleaned const needStorageReseed = await this.needsStorageReseed(); - const currentUserId = await this.stateService.getUserId(); const newActiveUser = await this.stateService.clean({ userId: userId }); - if (userId == null || userId === currentUserId) { - await this.searchService.clearIndex(); - } - await this.stateEventRunnerService.handleEvent("logout", userId); if (newActiveUser != null) { diff --git a/apps/desktop/src/app/app.component.ts b/apps/desktop/src/app/app.component.ts index 257921e2ad..b2b44e6b21 100644 --- a/apps/desktop/src/app/app.component.ts +++ b/apps/desktop/src/app/app.component.ts @@ -609,7 +609,6 @@ export class AppComponent implements OnInit, OnDestroy { // This must come last otherwise the logout will prematurely trigger // a process reload before all the state service user data can be cleaned up if (userBeingLoggedOut === preLogoutActiveUserId) { - await this.searchService.clearIndex(); this.authService.logOut(async () => { if (expired) { this.platformUtilsService.showToast( diff --git a/libs/common/src/services/search.service.ts b/libs/common/src/services/search.service.ts index 429992b076..38ddfe0e47 100644 --- a/libs/common/src/services/search.service.ts +++ b/libs/common/src/services/search.service.ts @@ -35,7 +35,7 @@ export const LUNR_SEARCH_INDEX = new UserKeyDefinition( "searchIndex", { deserializer: (obj: Jsonify) => obj, - clearOn: ["lock"], + clearOn: ["lock", "logout"], }, ); @@ -48,7 +48,7 @@ export const LUNR_SEARCH_INDEXED_ENTITY_ID = new UserKeyDefinition) => obj, - clearOn: ["lock"], + clearOn: ["lock", "logout"], }, ); @@ -61,7 +61,7 @@ export const LUNR_SEARCH_INDEXING = new UserKeyDefinition( "isIndexing", { deserializer: (obj: Jsonify) => obj, - clearOn: ["lock"], + clearOn: ["lock", "logout"], }, );