fix: crash on getUpdatedEnvVariables on certain cases
This commit is contained in:
@@ -91,9 +91,12 @@ export const runRESTRequest$ = (): TaskEither<
|
|||||||
})()
|
})()
|
||||||
|
|
||||||
if (isRight(runResult)) {
|
if (isRight(runResult)) {
|
||||||
|
debugger
|
||||||
|
|
||||||
setRESTTestResults(translateToSandboxTestResults(runResult.right))
|
setRESTTestResults(translateToSandboxTestResults(runResult.right))
|
||||||
|
|
||||||
setGlobalEnvVariables(runResult.right.envs.global)
|
setGlobalEnvVariables(runResult.right.envs.global)
|
||||||
|
|
||||||
if (environmentsStore.value.currentEnvironmentIndex !== -1) {
|
if (environmentsStore.value.currentEnvironmentIndex !== -1) {
|
||||||
const env = getEnviroment(
|
const env = getEnviroment(
|
||||||
environmentsStore.value.currentEnvironmentIndex
|
environmentsStore.value.currentEnvironmentIndex
|
||||||
@@ -154,14 +157,21 @@ const getUpdatedEnvVariables = (
|
|||||||
A.filterMap(
|
A.filterMap(
|
||||||
flow(
|
flow(
|
||||||
O.fromPredicate(
|
O.fromPredicate(
|
||||||
(x) =>
|
(x) => current.findIndex((y) => x.key === y.key) === -1
|
||||||
current.findIndex((y) => x.key === y.key && x.value !== y.value) ===
|
|
||||||
-1
|
|
||||||
),
|
),
|
||||||
O.map((x) => ({
|
O.chain(
|
||||||
...x,
|
O.fromPredicate(
|
||||||
previousValue: current.find((y) => x.key === y.key)!.value,
|
(x) => current.findIndex((y) => x.value !== y.value) === -1
|
||||||
}))
|
)
|
||||||
|
),
|
||||||
|
O.map((x) => {
|
||||||
|
const match = current.find((y) => x.key === y.key)!.value
|
||||||
|
|
||||||
|
return {
|
||||||
|
...x,
|
||||||
|
previousValue: match,
|
||||||
|
}
|
||||||
|
})
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
|
|||||||
Reference in New Issue
Block a user