Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion src/components/modals/EditPersonModal.vue
Original file line number Diff line number Diff line change
Expand Up @@ -276,7 +276,8 @@ export default {
}
},

emits: ['cancel'],
// eslint-disable-next-line vue/no-unused-emit-declarations
emits: ['cancel', 'confirm', 'confirm-invite', 'invite'],

data() {
return {
Expand Down
16 changes: 12 additions & 4 deletions src/store/modules/people.js
Original file line number Diff line number Diff line change
Expand Up @@ -165,7 +165,8 @@ const initialState = {
personTimeSpentTotal: 0,
personDayOff: {},
daysOff: [],
dayOffMap: {}
dayOffMap: {},
personMapVersion: 0
}

const state = {
Expand All @@ -182,7 +183,11 @@ const getters = {
cache.people.filter(person => person.active && !person.is_bot),
displayedPeople: state => state.displayedPeople,
peopleIndex: state => cache.peopleIndex,
personMap: state => cache.personMap,
personMap: state => {
// Access personMapVersion to trigger reactivity when the map changes.
state.personMapVersion // eslint-disable-line no-unused-expressions
return cache.personMap
},
isPeopleLoading: state => state.isPeopleLoading,
isPeopleLoadingError: state => state.isPeopleLoadingError,
peopleSearchQueries: state => state.peopleSearchQueries,
Expand Down Expand Up @@ -267,8 +272,8 @@ const actions = {
},

async newPersonAndInvite({ commit }, data) {
let person = await peopleApi.createPerson(data)
person = await peopleApi.invitePerson(person)
const person = await peopleApi.createPerson(data)
await peopleApi.invitePerson(person)
commit(EDIT_PEOPLE_END, person)
return person
},
Expand Down Expand Up @@ -614,6 +619,7 @@ const mutations = {
cache.people.forEach(person => {
cache.personMap.set(person.id, person)
})
state.personMapVersion++
state.displayedPeople = cache.people
cache.peopleIndex = buildPeopleIndex(cache.people)

Expand All @@ -630,6 +636,7 @@ const mutations = {
}
cache.personMap.delete(person.id)
}
state.personMapVersion++
cache.peopleIndex = buildPeopleIndex(cache.people)
if (state.peopleSearchText) {
const keywords = getKeyWords(state.peopleSearchText)
Expand All @@ -651,6 +658,7 @@ const mutations = {
cache.people.push(person)
}
cache.personMap.set(person.id, person)
state.personMapVersion++
cache.people = sortPeople(cache.people)
cache.peopleIndex = buildPeopleIndex(cache.people)
if (state.peopleSearchText) {
Expand Down