Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Queue contacts updates #879

Merged
merged 2 commits into from
Jan 24, 2019
Merged
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
46 changes: 16 additions & 30 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@
"nextcloud-server": "^0.15.9",
"nextcloud-vue": "^0.5.1",
"p-limit": "^2.1.0",
"p-queue": "^3.0.0",
"uuid": "^3.3.2",
"v-tooltip": "^2.0.0-rc.33",
"vue": "^2.5.22",
Expand Down
9 changes: 6 additions & 3 deletions src/components/ContactDetails.vue
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@
<!-- using contact.key in the key and index as key to avoid conflicts between similar data and exact key -->
<contact-property v-for="(property, index) in sortedProperties" :key="`${index}-${contact.key}-${property.name}`" :index="index"
:sorted-properties="sortedProperties" :property="property" :contact="contact"
@updatedcontact="updateContact" />
@updatedcontact="debounceUpdateContact" />

<!-- addressbook change select - no last property because class is not applied here,
empty property because this is a required prop on regular property-select. But since
Expand All @@ -119,6 +119,7 @@

<script>
import debounce from 'debounce'
import PQueue from 'p-queue'

import rfcProps from 'Models/rfcProps'

Expand All @@ -128,6 +129,8 @@ import PropertySelect from './Properties/PropertySelect'
import PropertyGroups from './Properties/PropertyGroups'
import ContactAvatar from './ContactDetails/ContactDetailsAvatar'

const updateQueue = new PQueue({ concurrency: 1 })

export default {
name: 'ContactDetails',

Expand Down Expand Up @@ -308,7 +311,7 @@ export default {
},
set: function(data) {
this.contact.groups = data
this.updateContact()
this.debounceUpdateContact()
skjnldsv marked this conversation as resolved.
Show resolved Hide resolved
}
},

Expand Down Expand Up @@ -368,7 +371,7 @@ export default {
* photo, fn, org, title
*/
debounceUpdateContact: debounce(function(e) {
this.updateContact()
updateQueue.add(this.updateContact)
}, 500),

// menu handling
Expand Down