Skip to content

Commit

Permalink
Merge pull request #879 from nextcloud/queue-request
Browse files Browse the repository at this point in the history
Queue contacts updates
  • Loading branch information
skjnldsv authored Jan 24, 2019
2 parents d0af418 + eae3c15 commit 9b3d292
Show file tree
Hide file tree
Showing 3 changed files with 23 additions and 33 deletions.
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()
}
},

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

0 comments on commit 9b3d292

Please sign in to comment.