Skip to content

Commit 06314a3

Browse files
committed
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>
1 parent f6b49b1 commit 06314a3

File tree

1 file changed

+6
-7
lines changed

1 file changed

+6
-7
lines changed

apps/files_sharing/src/views/SharingTab.vue

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -374,14 +374,13 @@ export default {
374374
* @param {Function} resolve a function to execute after
375375
*/
376376
awaitForShare(share, resolve) {
377-
let listComponent = this.$refs.shareList
378-
// Only mail shares comes from the input, link shares
379-
// are managed internally in the SharingLinkList component
380-
if (share.type === this.SHARE_TYPES.SHARE_TYPE_EMAIL) {
381-
listComponent = this.$refs.linkShareList
382-
}
383-
384377
this.$nextTick(() => {
378+
let listComponent = this.$refs.shareList
379+
// Only mail shares comes from the input, link shares
380+
// are managed internally in the SharingLinkList component
381+
if (share.type === this.SHARE_TYPES.SHARE_TYPE_EMAIL) {
382+
listComponent = this.$refs.linkShareList
383+
}
385384
const newShare = listComponent.$children.find(component => component.share === share)
386385
if (newShare) {
387386
resolve(newShare)

0 commit comments

Comments
 (0)