]> source.dussan.org Git - nextcloud-server.git/commitdiff
Create element reference inside $nextTick()
authorfenn-cs <fenn25.fn@gmail.com>
Wed, 6 Dec 2023 16:46:17 +0000 (17:46 +0100)
committerfenn-cs <fenn25.fn@gmail.com>
Wed, 6 Dec 2023 21:11:27 +0000 (22:11 +0100)
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>
apps/files_sharing/src/views/SharingTab.vue

index 6ec8f25fcf6a5312a7f5135be508a036f4cb78f8..19033bf9184d339254aac4ad0dc31347d1fa28fc 100644 (file)
@@ -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)