diff --git a/.github/workflows/deploy-netlify.yml b/.github/workflows/deploy-netlify.yml index e141db6e0..4837d45bc 100644 --- a/.github/workflows/deploy-netlify.yml +++ b/.github/workflows/deploy-netlify.yml @@ -19,7 +19,7 @@ jobs: run_install: true - name: Setup Environment - run: mv packages/hoppscotch-app/.env.example packages/hoppscotch-app/.env + run: mv packages/hoppscotch-app/.env packages/hoppscotch-app/.env - name: Build Site run: pnpm run generate diff --git a/Dockerfile b/Dockerfile index 1572b03f3..4b3f6b654 100644 --- a/Dockerfile +++ b/Dockerfile @@ -22,7 +22,7 @@ RUN pnpm i --unsafe-perm=true ENV HOST 0.0.0.0 EXPOSE 3000 -RUN mv packages/hoppscotch-app/.env.example packages/hoppscotch-app/.env +RUN mv packages/hoppscotch-app/.env packages/hoppscotch-app/.env RUN pnpm run generate diff --git a/packages/hoppscotch-app/components/http/Variables.vue b/packages/hoppscotch-app/components/http/Variables.vue index f768f4302..e0493e064 100644 --- a/packages/hoppscotch-app/components/http/Variables.vue +++ b/packages/hoppscotch-app/components/http/Variables.vue @@ -92,7 +92,7 @@ const toast = useToast() const emptyVars: string = "Add a new variable" -const idTickerV = ref(0) +const idTicker = ref(0) const deletionToast = ref<{ goAway: (delay: number) => void } | null>(null) @@ -101,7 +101,7 @@ const vars = useStream(restVars$, [], setRESTVars) as Ref // The UI representation of the variables list (has the empty end variable) const workingVars = ref>([ { - id: idTickerV.value++, + id: idTicker.value++, key: "", value: "", }, @@ -111,13 +111,38 @@ const workingVars = ref>([ watch(workingVars, (varsList) => { if (varsList.length > 0 && varsList[varsList.length - 1].key !== "") { workingVars.value.push({ - id: idTickerV.value++, + id: idTicker.value++, key: "", value: "", }) } }) +// Sync logic between params and working/bulk params +watch( + vars, + (newParamsList) => { + // Sync should overwrite working params + const filteredWorkingVars: HoppRESTVar[] = pipe( + workingVars.value, + A.filterMap( + flow( + O.fromPredicate((e) => e.key !== ""), + O.map(objRemoveKey("id")) + ) + ) + ) + + if (!isEqual(newParamsList, filteredWorkingVars)) { + workingVars.value = pipe( + newParamsList, + A.map((x) => ({ id: idTicker.value++, ...x })) + ) + } + }, + { immediate: true } +) + watch(workingVars, (newWorkingVars) => { const fixedVars = pipe( newWorkingVars, @@ -136,7 +161,7 @@ watch(workingVars, (newWorkingVars) => { const addVar = () => { workingVars.value.push({ - id: idTickerV.value++, + id: idTicker.value++, key: "", value: "", }) diff --git a/packages/hoppscotch-app/newstore/RESTSession.ts b/packages/hoppscotch-app/newstore/RESTSession.ts index a410da2bc..eb21d0f27 100644 --- a/packages/hoppscotch-app/newstore/RESTSession.ts +++ b/packages/hoppscotch-app/newstore/RESTSession.ts @@ -4,12 +4,12 @@ import { FormDataKeyValue, HoppRESTHeader, HoppRESTParam, + HoppRESTVar, HoppRESTReqBody, HoppRESTRequest, RESTReqSchemaVersion, HoppRESTAuth, ValidContentTypes, - HoppRESTVar, } from "@hoppscotch/data" import DispatchingStore, { defineDispatchers } from "./DispatchingStore" import { HoppRESTResponse } from "~/helpers/types/HoppRESTResponse" diff --git a/packages/hoppscotch-app/newstore/localpersistence.ts b/packages/hoppscotch-app/newstore/localpersistence.ts index 83c654fb9..a6f7a033a 100644 --- a/packages/hoppscotch-app/newstore/localpersistence.ts +++ b/packages/hoppscotch-app/newstore/localpersistence.ts @@ -321,8 +321,6 @@ function setupRequestPersistence() { } window.localStorage.setItem("restRequest", JSON.stringify(reqClone)) }) - - console.log("localRequest", localRequest) } export function setupLocalPersistence() {