diff --git a/packages/hoppscotch-common/src/components/embeds/index.vue b/packages/hoppscotch-common/src/components/embeds/index.vue
index 8a614141f..adbcedf78 100644
--- a/packages/hoppscotch-common/src/components/embeds/index.vue
+++ b/packages/hoppscotch-common/src/components/embeds/index.vue
@@ -123,9 +123,9 @@ const sharedRequestURL = computed(() => {
})
const tabRequestVariables = computed(() => {
- return tab.value.document.request.requestVariables.map((v) => ({
- key: v.key,
- value: v.value,
+ return tab.value.document.request.requestVariables.map(({ key, value }) => ({
+ key,
+ value,
secret: false,
sourceEnv: "RequestVariable",
}))
diff --git a/packages/hoppscotch-common/src/components/http/CodegenModal.vue b/packages/hoppscotch-common/src/components/http/CodegenModal.vue
index 3044b548a..510e00ae8 100644
--- a/packages/hoppscotch-common/src/components/http/CodegenModal.vue
+++ b/packages/hoppscotch-common/src/components/http/CodegenModal.vue
@@ -196,7 +196,7 @@ const requestCode = computed(() => {
value: requestVariable.value,
secret: false,
}
- return []
+ return {}
}
)
const env: Environment = {
diff --git a/packages/hoppscotch-common/src/components/http/OAuth2Authorization.vue b/packages/hoppscotch-common/src/components/http/OAuth2Authorization.vue
index fc1634257..a6dbc0a51 100644
--- a/packages/hoppscotch-common/src/components/http/OAuth2Authorization.vue
+++ b/packages/hoppscotch-common/src/components/http/OAuth2Authorization.vue
@@ -18,7 +18,7 @@
:auto-complete-env="true"
:styles="hasOIDCURL ? 'pointer-events-none opacity-70' : ''"
:envs="envs"
- >
+ />
@@ -25,10 +25,10 @@
/>
@@ -49,7 +49,7 @@
/>
@@ -131,31 +131,27 @@ const changeOptionTab = (e: RESTOptionTabs) => {
selectedOptionTab.value = e
}
-const newActiveParamsCount$ = computed(() => {
- const e = request.value.params.filter(
- (x) => x.active && (x.key !== "" || x.value !== "")
+const newActiveParamsCount = computed(() => {
+ const count = request.value.params.filter(
+ (x) => x.active && (x.key || x.value)
).length
- if (e === 0) return null
- return `${e}`
+ return count ? count : null
})
-const newActiveHeadersCount$ = computed(() => {
- const e = request.value.headers.filter(
- (x) => x.active && (x.key !== "" || x.value !== "")
+const newActiveHeadersCount = computed(() => {
+ const count = request.value.headers.filter(
+ (x) => x.active && (x.key || x.value)
).length
- if (e === 0) return null
- return `${e}`
+ return count ? count : null
})
-const newActiveRequestVariablesCount$ = computed(() => {
- const e = request.value.requestVariables.filter(
- (x) => x.active && (x.key !== "" || x.value !== "")
+const newActiveRequestVariablesCount = computed(() => {
+ const count = request.value.requestVariables.filter(
+ (x) => x.active && (x.key || x.value)
).length
-
- if (e === 0) return null
- return `${e}`
+ return count ? count : null
})
defineActionHandler("request.open-tab", ({ tab }) => {
diff --git a/packages/hoppscotch-common/src/components/http/RequestVariables.vue b/packages/hoppscotch-common/src/components/http/RequestVariables.vue
index 9a3d06de7..b8993b604 100644
--- a/packages/hoppscotch-common/src/components/http/RequestVariables.vue
+++ b/packages/hoppscotch-common/src/components/http/RequestVariables.vue
@@ -49,7 +49,7 @@
-
-
-
+
-
-
-
-
-
-
+
+
>([
{
@@ -255,7 +249,7 @@ watch(
(newRequestVariableList) => {
// Sync should overwrite working params
const filteredWorkingRequestVariables: HoppRESTRequestVariable[] = pipe(
- workingRequestVaraiables.value,
+ workingRequestVariables.value,
A.filterMap(
flow(
O.fromPredicate((e) => e.key !== ""),
@@ -276,7 +270,7 @@ watch(
)
if (!isEqual(newRequestVariableList, filteredWorkingRequestVariables)) {
- workingRequestVaraiables.value = pipe(
+ workingRequestVariables.value = pipe(
newRequestVariableList,
A.map((x) => ({ id: idTicker.value++, ...x }))
)
@@ -289,7 +283,7 @@ watch(
{ immediate: true }
)
-watch(workingRequestVaraiables, (newWorkingRequestVariables) => {
+watch(workingRequestVariables, (newWorkingRequestVariables) => {
const fixedRequestVariables = pipe(
newWorkingRequestVariables,
A.filterMap(
@@ -323,12 +317,12 @@ watch(bulkVariables, (newBulkParams) => {
})
// Rule: Working Request variable always have last element is always an empty param
-watch(workingRequestVaraiables, (variableList) => {
+watch(workingRequestVariables, (variableList) => {
if (
variableList.length > 0 &&
variableList[variableList.length - 1].key !== ""
) {
- workingRequestVaraiables.value.push({
+ workingRequestVariables.value.push({
id: idTicker.value++,
key: "",
value: "",
@@ -338,7 +332,7 @@ watch(workingRequestVaraiables, (variableList) => {
})
const addVariable = () => {
- workingRequestVaraiables.value.push({
+ workingRequestVariables.value.push({
id: idTicker.value++,
key: "",
value: "",
@@ -347,14 +341,14 @@ const addVariable = () => {
}
const updateVariable = (index: number, variable: any & { id: number }) => {
- workingRequestVaraiables.value = workingRequestVaraiables.value.map((h, i) =>
+ workingRequestVariables.value = workingRequestVariables.value.map((h, i) =>
i === index ? variable : h
)
}
const deleteVariable = (index: number) => {
const requestVariablesBeforeDeletion = cloneDeep(
- workingRequestVaraiables.value
+ workingRequestVariables.value
)
if (
@@ -373,7 +367,7 @@ const deleteVariable = (index: number) => {
{
text: `${t("action.undo")}`,
onClick: (_, toastObject) => {
- workingRequestVaraiables.value = requestVariablesBeforeDeletion
+ workingRequestVariables.value = requestVariablesBeforeDeletion
toastObject.goAway(0)
deletionToast.value = null
},
@@ -386,8 +380,8 @@ const deleteVariable = (index: number) => {
})
}
- workingRequestVaraiables.value = pipe(
- workingRequestVaraiables.value,
+ workingRequestVariables.value = pipe(
+ workingRequestVariables.value,
A.deleteAt(index),
O.getOrElseW(() =>
throwError("Working Request Variable Deletion Out of Bounds")
@@ -397,7 +391,7 @@ const deleteVariable = (index: number) => {
const clearContent = () => {
// set params list to the initial state
- workingRequestVaraiables.value = [
+ workingRequestVariables.value = [
{
id: idTicker.value++,
key: "",
diff --git a/packages/hoppscotch-common/src/composables/codemirror.ts b/packages/hoppscotch-common/src/composables/codemirror.ts
index 8236a862a..cd4214405 100644
--- a/packages/hoppscotch-common/src/composables/codemirror.ts
+++ b/packages/hoppscotch-common/src/composables/codemirror.ts
@@ -243,7 +243,7 @@ export function useCodemirror(
if (from === to) return
const text = view.value?.state.doc.sliceString(from, to)
const { top, left } = view.value?.coordsAtPos(from)
- if (text && text.trim()) {
+ if (text?.trim()) {
invokeAction("contextmenu.open", {
position: {
top,
diff --git a/packages/hoppscotch-common/src/helpers/editor/extensions/HoppEnvironment.ts b/packages/hoppscotch-common/src/helpers/editor/extensions/HoppEnvironment.ts
index e09f08b77..31ab8f2bc 100644
--- a/packages/hoppscotch-common/src/helpers/editor/extensions/HoppEnvironment.ts
+++ b/packages/hoppscotch-common/src/helpers/editor/extensions/HoppEnvironment.ts
@@ -138,7 +138,7 @@ const cursorTooltipField = (aggregateEnvs: AggregateEnvironment[]) =>
"requestVariables"
} else {
invokeAction(invokeActionType, {
- envName: tooltipEnv?.sourceEnv !== "Global" ? envName : "Global",
+ envName: tooltipEnv?.sourceEnv === "Global" ? "Global" : envName,
variableName: parsedEnvKey,
isSecret: tooltipEnv?.secret,
})
@@ -236,9 +236,9 @@ export class HoppEnvironmentPlugin {
currentTab.document.request,
(reqVariables) => {
this.envs = [
- ...reqVariables.requestVariables.map((variable) => ({
- key: variable.key,
- value: variable.value,
+ ...reqVariables.requestVariables.map(({ key, value }) => ({
+ key,
+ value,
sourceEnv: "RequestVariable",
secret: false,
})),
@@ -257,12 +257,14 @@ export class HoppEnvironmentPlugin {
subscribeToStream(aggregateEnvsWithSecrets$, (envs) => {
this.envs = [
- ...currentTab.document.request.requestVariables.map((variable) => ({
- key: variable.key,
- value: variable.value,
- sourceEnv: "RequestVariable",
- secret: false,
- })),
+ ...currentTab.document.request.requestVariables.map(
+ ({ key, value }) => ({
+ key,
+ value,
+ sourceEnv: "RequestVariable",
+ secret: false,
+ })
+ ),
...envs,
]
diff --git a/packages/hoppscotch-common/src/services/inspection/inspectors/environment.inspector.ts b/packages/hoppscotch-common/src/services/inspection/inspectors/environment.inspector.ts
index aeb909e88..0a444bf64 100644
--- a/packages/hoppscotch-common/src/services/inspection/inspectors/environment.inspector.ts
+++ b/packages/hoppscotch-common/src/services/inspection/inspectors/environment.inspector.ts
@@ -225,9 +225,9 @@ export class EnvironmentInspectorService extends Service implements Inspector {
} else {
invokeAction(invokeActionType, {
envName:
- env.sourceEnv !== "Global"
- ? currentSelectedEnvironment.name
- : "Global",
+ env.sourceEnv === "Global"
+ ? "Global"
+ : currentSelectedEnvironment.name,
variableName: formattedExEnv,
isSecret: env.secret,
})