mirror of
https://github.com/nextcloud/server.git
synced 2026-06-09 00:32:29 -04:00
Create element reference inside $nextTick()
Accessing `this.$refs.shareList` outside $nextTick() could lead to the holder (`listComponent`) being undefined as the ref is yet to exist. Signed-off-by: fenn-cs <fenn25.fn@gmail.com>
This commit is contained in:
parent
d9abfa002d
commit
9c67ae4ec1
1 changed files with 6 additions and 7 deletions
|
|
@ -374,14 +374,13 @@ export default {
|
|||
* @param {Function} resolve a function to execute after
|
||||
*/
|
||||
awaitForShare(share, resolve) {
|
||||
let listComponent = this.$refs.shareList
|
||||
// Only mail shares comes from the input, link shares
|
||||
// are managed internally in the SharingLinkList component
|
||||
if (share.type === this.SHARE_TYPES.SHARE_TYPE_EMAIL) {
|
||||
listComponent = this.$refs.linkShareList
|
||||
}
|
||||
|
||||
this.$nextTick(() => {
|
||||
let listComponent = this.$refs.shareList
|
||||
// Only mail shares comes from the input, link shares
|
||||
// are managed internally in the SharingLinkList component
|
||||
if (share.type === this.SHARE_TYPES.SHARE_TYPE_EMAIL) {
|
||||
listComponent = this.$refs.linkShareList
|
||||
}
|
||||
const newShare = listComponent.$children.find(component => component.share === share)
|
||||
if (newShare) {
|
||||
resolve(newShare)
|
||||
|
|
|
|||
Loading…
Reference in a new issue