1
0
mirror of https://github.com/bitwarden/browser synced 2024-12-12 09:17:47 +01:00

[PM-4700] Fixed issue with clearing search index state (#8686)

* fixed issue with clearing search index state

* Decrease snap description character length to reach 128 limit (#8687)

* clear user index before account is totally cleaned up

* [AC-2436] Fix flashing unassigned items banner (#8689)

* Fix flashing banner for users who shouldn't see it

* Emit the right value the first time

* simplify further

* restore comment

* added logout clear on option

* removed redundant clear index from logout

---------

Co-authored-by: Joseph Flinn <58369717+joseph-flinn@users.noreply.github.com>
Co-authored-by: Thomas Rittson <31796059+eliykat@users.noreply.github.com>
This commit is contained in:
SmithThe4th 2024-04-11 17:53:16 +01:00 committed by GitHub
parent b843aa6bd1
commit c2b91d2d46
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
3 changed files with 3 additions and 9 deletions

View File

@ -1181,13 +1181,8 @@ export default class MainBackground {
//Needs to be checked before state is cleaned //Needs to be checked before state is cleaned
const needStorageReseed = await this.needsStorageReseed(); const needStorageReseed = await this.needsStorageReseed();
const currentUserId = await this.stateService.getUserId();
const newActiveUser = await this.stateService.clean({ userId: userId }); const newActiveUser = await this.stateService.clean({ userId: userId });
if (userId == null || userId === currentUserId) {
await this.searchService.clearIndex();
}
await this.stateEventRunnerService.handleEvent("logout", userId); await this.stateEventRunnerService.handleEvent("logout", userId);
if (newActiveUser != null) { if (newActiveUser != null) {

View File

@ -609,7 +609,6 @@ export class AppComponent implements OnInit, OnDestroy {
// This must come last otherwise the logout will prematurely trigger // This must come last otherwise the logout will prematurely trigger
// a process reload before all the state service user data can be cleaned up // a process reload before all the state service user data can be cleaned up
if (userBeingLoggedOut === preLogoutActiveUserId) { if (userBeingLoggedOut === preLogoutActiveUserId) {
await this.searchService.clearIndex();
this.authService.logOut(async () => { this.authService.logOut(async () => {
if (expired) { if (expired) {
this.platformUtilsService.showToast( this.platformUtilsService.showToast(

View File

@ -35,7 +35,7 @@ export const LUNR_SEARCH_INDEX = new UserKeyDefinition<SerializedLunrIndex>(
"searchIndex", "searchIndex",
{ {
deserializer: (obj: Jsonify<SerializedLunrIndex>) => obj, deserializer: (obj: Jsonify<SerializedLunrIndex>) => obj,
clearOn: ["lock"], clearOn: ["lock", "logout"],
}, },
); );
@ -48,7 +48,7 @@ export const LUNR_SEARCH_INDEXED_ENTITY_ID = new UserKeyDefinition<IndexedEntity
"searchIndexedEntityId", "searchIndexedEntityId",
{ {
deserializer: (obj: Jsonify<IndexedEntityId>) => obj, deserializer: (obj: Jsonify<IndexedEntityId>) => obj,
clearOn: ["lock"], clearOn: ["lock", "logout"],
}, },
); );
@ -61,7 +61,7 @@ export const LUNR_SEARCH_INDEXING = new UserKeyDefinition<boolean>(
"isIndexing", "isIndexing",
{ {
deserializer: (obj: Jsonify<boolean>) => obj, deserializer: (obj: Jsonify<boolean>) => obj,
clearOn: ["lock"], clearOn: ["lock", "logout"],
}, },
); );