Skip to content

Open-Source API Development Ecosystem • https://hoppscotch.io • Offline, On-Prem & Cloud • Web, Desktop & CLI • Open-Source Alternative to Postman, Insomnia

fix: analytics logging behavior being incorrect (#3064)

Andrew Bastinaeb9172144f3
diff --git a/packages/hoppscotch-common/src/components/http/Request.vue b/packages/hoppscotch-common/src/components/http/Request.vue
index a6f8b8e97..079d0c86a 100644
--- a/packages/hoppscotch-common/src/components/http/Request.vue
+++ b/packages/hoppscotch-common/src/components/http/Request.vue
@@ -258,6 +258,8 @@ import IconSave from "~icons/lucide/save"
import IconShare2 from "~icons/lucide/share-2"
import { HoppRESTTab } from "~/helpers/rest/tab"
import { getDefaultRESTRequest } from "~/helpers/rest/default"
+import { platform } from "~/platform"
+import { getCurrentStrategyID } from "~/helpers/network"
const t = useI18n()
@@ -320,6 +322,12 @@ const newSendRequest = async () => {
loading.value = true
+ // Log the request run into analytics
+ platform.analytics?.logHoppRequestRunToAnalytics({
+ platform: "rest",
+ strategy: getCurrentStrategyID(),
+ })
+
// Double calling is because the function returns a TaskEither than should be executed
const streamResult = await runRESTRequest$(tab)()
diff --git a/packages/hoppscotch-common/src/composables/codemirror.ts b/packages/hoppscotch-common/src/composables/codemirror.ts
index 8dbfaf0a1..1c5c58b3e 100644
--- a/packages/hoppscotch-common/src/composables/codemirror.ts
+++ b/packages/hoppscotch-common/src/composables/codemirror.ts
@@ -187,6 +187,8 @@ export function useCodemirror(
: null
const initView = (el: any) => {
+ if (el) platform.ui?.onCodemirrorInstanceMount?.(el)
+
const extensions = [
basicSetup,
baseTheme,
@@ -268,7 +270,6 @@ export function useCodemirror(
onMounted(() => {
if (el.value) {
if (!view.value) initView(el.value)
- platform.ui?.onCodemirrorInstanceMount?.(el.value)
}
})