From b6198925adf76168889c44727d7a1393253ef044 Mon Sep 17 00:00:00 2001 From: naman-bruno Date: Thu, 16 Jan 2025 19:59:14 +0530 Subject: [PATCH] fix: Request vars displayed in red color in body even if they are valid (#3812) * fix: Request vars displayed in red color in body * chore: removing index import --------- Co-authored-by: Anoop M D --- packages/bruno-app/src/components/CodeEditor/index.js | 6 +++--- .../src/components/RequestPane/RequestBody/index.js | 1 + 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/packages/bruno-app/src/components/CodeEditor/index.js b/packages/bruno-app/src/components/CodeEditor/index.js index 168a3b02be..398007a4ab 100644 --- a/packages/bruno-app/src/components/CodeEditor/index.js +++ b/packages/bruno-app/src/components/CodeEditor/index.js @@ -7,12 +7,12 @@ import React from 'react'; import { isEqual, escapeRegExp } from 'lodash'; -import { getEnvironmentVariables } from 'utils/collections'; import { defineCodeMirrorBrunoVariablesMode } from 'utils/common/codemirror'; import StyledWrapper from './StyledWrapper'; import * as jsonlint from '@prantlf/jsonlint'; import { JSHINT } from 'jshint'; import stripJsonComments from 'strip-json-comments'; +import { getAllVariables } from 'utils/collections'; let CodeMirror; const SERVER_RENDERED = typeof window === 'undefined' || global['PREVENT_CODEMIRROR_RENDER'] === true; @@ -293,7 +293,7 @@ export default class CodeEditor extends React.Component { } if (this.editor) { - let variables = getEnvironmentVariables(this.props.collection); + let variables = getAllVariables(this.props.collection, this.props.item); if (!isEqual(variables, this.variables)) { this.addOverlay(); } @@ -333,7 +333,7 @@ export default class CodeEditor extends React.Component { addOverlay = () => { const mode = this.props.mode || 'application/ld+json'; - let variables = getEnvironmentVariables(this.props.collection); + let variables = getAllVariables(this.props.collection, this.props.item); this.variables = variables; defineCodeMirrorBrunoVariablesMode(variables, mode); diff --git a/packages/bruno-app/src/components/RequestPane/RequestBody/index.js b/packages/bruno-app/src/components/RequestPane/RequestBody/index.js index 5fde52ea09..ca60c8662a 100644 --- a/packages/bruno-app/src/components/RequestPane/RequestBody/index.js +++ b/packages/bruno-app/src/components/RequestPane/RequestBody/index.js @@ -48,6 +48,7 @@ const RequestBody = ({ item, collection }) => {