fix extra indexes not working
This commit is contained in:
parent
8eb5ab3cda
commit
5ef72358aa
1 changed files with 9 additions and 9 deletions
|
|
@ -170,9 +170,15 @@ export const useUsersStore = defineStore('users', {
|
||||||
|
|
||||||
const { relationship: unused1, ...newUser } = user
|
const { relationship: unused1, ...newUser } = user
|
||||||
|
|
||||||
// Initializing reactivity
|
let reactive = this.users.get(user.id)
|
||||||
if (!this.users.has(user.id)) this.users.set(user.id, existing)
|
// Initializing reactivity & avoiding excessive Map mutation
|
||||||
const reactive = this.users.get(user.id)
|
if (!reactive) {
|
||||||
|
this.users.set(user.id, existing)
|
||||||
|
|
||||||
|
reactive = this.users.get(user.id)
|
||||||
|
this.usersByName.set(user.screen_name.toLowerCase(), reactive)
|
||||||
|
this.usersByURL.set(user.url.toLowerCase(), reactive)
|
||||||
|
}
|
||||||
|
|
||||||
// Relying on object reactivity to avoid mutating the Map
|
// Relying on object reactivity to avoid mutating the Map
|
||||||
reactive.relationship = relationship
|
reactive.relationship = relationship
|
||||||
|
|
@ -184,12 +190,6 @@ export const useUsersStore = defineStore('users', {
|
||||||
// Updating the timestamp
|
// Updating the timestamp
|
||||||
this.timestamps.set(reactive, timestamp)
|
this.timestamps.set(reactive, timestamp)
|
||||||
|
|
||||||
// Avoiding excessive Map mutation
|
|
||||||
if (!this.users.has(user.id)) {
|
|
||||||
this.usersByName.set(user.screen_name.toLowerCase(), reactive)
|
|
||||||
this.usersByURL.set(user.url.toLowerCase(), reactive)
|
|
||||||
}
|
|
||||||
|
|
||||||
if (user.id === this.currentUser?.id) {
|
if (user.id === this.currentUser?.id) {
|
||||||
this.currentUser = reactive
|
this.currentUser = reactive
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue