fix: response time for requests via extension has incorrect value (#2921)
Co-authored-by: Andrew Bastin <andrewbastin.k@gmail.com>
This commit is contained in:
@@ -274,6 +274,10 @@ import { createShortcode } from "~/helpers/backend/mutations/Shortcode"
|
|||||||
import { runMutation } from "~/helpers/backend/GQLClient"
|
import { runMutation } from "~/helpers/backend/GQLClient"
|
||||||
import { UpdateRequestDocument } from "~/helpers/backend/graphql"
|
import { UpdateRequestDocument } from "~/helpers/backend/graphql"
|
||||||
import { getPlatformSpecialKey as getSpecialKey } from "~/helpers/platformutils"
|
import { getPlatformSpecialKey as getSpecialKey } from "~/helpers/platformutils"
|
||||||
|
import {
|
||||||
|
cancelRunningExtensionRequest,
|
||||||
|
hasExtensionInstalled,
|
||||||
|
} from "~/helpers/strategies/ExtensionStrategy"
|
||||||
|
|
||||||
const t = useI18n()
|
const t = useI18n()
|
||||||
|
|
||||||
@@ -403,6 +407,9 @@ function isCURL(curl: string) {
|
|||||||
|
|
||||||
const cancelRequest = () => {
|
const cancelRequest = () => {
|
||||||
loading.value = false
|
loading.value = false
|
||||||
|
if (hasExtensionInstalled()) {
|
||||||
|
cancelRunningExtensionRequest()
|
||||||
|
}
|
||||||
updateRESTResponse(null)
|
updateRESTResponse(null)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -16,7 +16,7 @@ export const hasFirefoxExtensionInstalled = () =>
|
|||||||
hasExtensionInstalled() && browserIsFirefox()
|
hasExtensionInstalled() && browserIsFirefox()
|
||||||
|
|
||||||
export const cancelRunningExtensionRequest = () => {
|
export const cancelRunningExtensionRequest = () => {
|
||||||
window.__POSTWOMAN_EXTENSION_HOOK__?.cancelRunningRequest()
|
window.__POSTWOMAN_EXTENSION_HOOK__?.cancelRequest()
|
||||||
}
|
}
|
||||||
|
|
||||||
export const defineSubscribableObject = <T extends object>(obj: T) => {
|
export const defineSubscribableObject = <T extends object>(obj: T) => {
|
||||||
|
|||||||
12
packages/hoppscotch-common/src/shims.d.ts
vendored
12
packages/hoppscotch-common/src/shims.d.ts
vendored
@@ -8,7 +8,7 @@ interface PWExtensionHook {
|
|||||||
sendRequest: (
|
sendRequest: (
|
||||||
req: AxiosRequestConfig & { wantsBinary: boolean }
|
req: AxiosRequestConfig & { wantsBinary: boolean }
|
||||||
) => Promise<NetworkResponse>
|
) => Promise<NetworkResponse>
|
||||||
cancelRunningRequest: () => void
|
cancelRequest: () => void
|
||||||
}
|
}
|
||||||
|
|
||||||
type HoppExtensionStatusHook = {
|
type HoppExtensionStatusHook = {
|
||||||
@@ -18,17 +18,9 @@ type HoppExtensionStatusHook = {
|
|||||||
}
|
}
|
||||||
subscribe(prop: "status", func: (...args: any[]) => any): void
|
subscribe(prop: "status", func: (...args: any[]) => any): void
|
||||||
}
|
}
|
||||||
declare global {
|
export declare global {
|
||||||
interface Window {
|
interface Window {
|
||||||
__POSTWOMAN_EXTENSION_HOOK__: PWExtensionHook | undefined
|
__POSTWOMAN_EXTENSION_HOOK__: PWExtensionHook | undefined
|
||||||
__HOPP_EXTENSION_STATUS_PROXY__: HoppExtensionStatusHook | undefined
|
__HOPP_EXTENSION_STATUS_PROXY__: HoppExtensionStatusHook | undefined
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Vue builtins
|
|
||||||
declare module '*.vue' {
|
|
||||||
import type { DefineComponent } from 'vue'
|
|
||||||
// eslint-disable-next-line @typescript-eslint/no-explicit-any, @typescript-eslint/ban-types
|
|
||||||
const component: DefineComponent<{}, {}, any>
|
|
||||||
export default component
|
|
||||||
}
|
|
||||||
|
|||||||
Reference in New Issue
Block a user