Skip to content

Commit

Permalink
fix: Collection variable viewer (usebruno#1947)
Browse files Browse the repository at this point in the history
Due to changes in usebruno#650
collection variables would be passed as a object but was exptected
to be an array. Collection variables are now converted to an array.
  • Loading branch information
Its-treason authored and slowjoe007 committed Apr 10, 2024
1 parent 2915120 commit 6f3b094
Showing 1 changed file with 8 additions and 3 deletions.
11 changes: 8 additions & 3 deletions packages/bruno-app/src/components/VariablesEditor/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,7 @@ import { findEnvironmentInCollection, maskInputValue } from 'utils/collections';
import StyledWrapper from './StyledWrapper';
import { IconEye, IconEyeOff } from '@tabler/icons';

const KeyValueExplorer = ({ data, theme }) => {
data = data || {};
const KeyValueExplorer = ({ data = [], theme }) => {
const [showSecret, setShowSecret] = useState(false);

return (
Expand Down Expand Up @@ -66,11 +65,17 @@ const EnvVariables = ({ collection, theme }) => {
const CollectionVariables = ({ collection, theme }) => {
const collectionVariablesFound = Object.keys(collection.collectionVariables).length > 0;

const collectionVariableArray = Object.entries(collection.collectionVariables).map(([name, value]) => ({
name,
value,
secret: false
}));

return (
<>
<h1 className="font-semibold mb-2">Collection Variables</h1>
{collectionVariablesFound ? (
<KeyValueExplorer data={collection.collectionVariables} theme={theme} />
<KeyValueExplorer data={collectionVariableArray} theme={theme} />
) : (
<div className="muted text-xs">No collection variables found</div>
)}
Expand Down

0 comments on commit 6f3b094

Please sign in to comment.