From 59ee4babeb24151905b72aa8e7f95e4ef8397333 Mon Sep 17 00:00:00 2001 From: Akash K <57758277+amk-dev@users.noreply.github.com> Date: Thu, 6 Oct 2022 16:06:14 +0530 Subject: [PATCH] fix: fix ref access when using v-for on Invite.vue (#2744) Co-authored-by: Andrew Bastin --- .../collections/teams/Collection.vue | 34 ++++++++++--------- .../components/collections/teams/Folder.vue | 34 ++++++++++--------- .../src/components/teams/Invite.vue | 5 +-- 3 files changed, 39 insertions(+), 34 deletions(-) diff --git a/packages/hoppscotch-app/src/components/collections/teams/Collection.vue b/packages/hoppscotch-app/src/components/collections/teams/Collection.vue index f06d7a5d7..45df63dc2 100644 --- a/packages/hoppscotch-app/src/components/collections/teams/Collection.vue +++ b/packages/hoppscotch-app/src/components/collections/teams/Collection.vue @@ -8,7 +8,7 @@ @drop="dragging = false" @dragleave="dragging = false" @dragend="dragging = false" - @contextmenu.prevent="options.tippy.show()" + @contextmenu.prevent="options!.tippy.show()" > (null), - options: ref(null), - requestAction: ref(null), - folderAction: ref(null), - edit: ref(null), - deleteAction: ref(null), - exportAction: ref(null), + tippyActions: ref(null), + options: ref(null), + requestAction: ref(null), + folderAction: ref(null), + edit: ref(null), + deleteAction: ref(null), + exportAction: ref(null), exportLoading: ref(false), t, toast: useToast(), @@ -332,7 +334,7 @@ export default defineComponent({ this.toast.error(this.t("error.something_went_wrong").toString()) console.log(result.left) this.exportLoading = false - this.options.tippy().hide() + this.options!.tippy.hide() return } @@ -358,7 +360,7 @@ export default defineComponent({ this.exportLoading = false - this.options.tippy().hide() + this.options!.tippy.hide() }, editRequest(event: any) { this.$emit("edit-request", event) diff --git a/packages/hoppscotch-app/src/components/collections/teams/Folder.vue b/packages/hoppscotch-app/src/components/collections/teams/Folder.vue index 7b2a1a94a..d5eee2df0 100644 --- a/packages/hoppscotch-app/src/components/collections/teams/Folder.vue +++ b/packages/hoppscotch-app/src/components/collections/teams/Folder.vue @@ -8,7 +8,7 @@ @drop="dragging = false" @dragleave="dragging = false" @dragend="dragging = false" - @contextmenu.prevent="options.tippy.show()" + @contextmenu.prevent="options!.tippy.show()" > (null), - options: ref(null), - requestAction: ref(null), - folderAction: ref(null), - edit: ref(null), - deleteAction: ref(null), - exportAction: ref(null), + tippyActions: ref(null), + options: ref(null), + requestAction: ref(null), + folderAction: ref(null), + edit: ref(null), + deleteAction: ref(null), + exportAction: ref(null), exportLoading: ref(false), toast: useToast(), t: useI18n(), @@ -317,7 +319,7 @@ export default defineComponent({ this.toast.error(this.t("error.something_went_wrong").toString()) console.log(result.left) this.exportLoading = false - this.options.tippy().hide() + this.options!.tippy.hide() return } @@ -343,7 +345,7 @@ export default defineComponent({ this.exportLoading = false - this.options.tippy().hide() + this.options!.tippy.hide() }, toggleShowChildren() { if (this.$props.saveRequest) diff --git a/packages/hoppscotch-app/src/components/teams/Invite.vue b/packages/hoppscotch-app/src/components/teams/Invite.vue index 4c9bf132e..631c71cf2 100644 --- a/packages/hoppscotch-app/src/components/teams/Invite.vue +++ b/packages/hoppscotch-app/src/components/teams/Invite.vue @@ -143,7 +143,7 @@ interactive trigger="click" theme="popover" - :on-shown="() => tippyActions.focus()" + :on-shown="() => tippyActions![index].focus()" > (null) +const tippyActions = ref(null) const props = defineProps({ show: Boolean,