Skip to content

Commit

Permalink
Don't show variables list when no variables are visible
Browse files Browse the repository at this point in the history
  • Loading branch information
desplesda committed Dec 9, 2024
1 parent c732fb4 commit 8c29216
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 2 deletions.
2 changes: 1 addition & 1 deletion src/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -128,7 +128,7 @@ <h1>Try Yarn Spinner</h1>
style="max-height: 25%; overflow-y: scroll"
>
<div class="col-12">
<div id="variables">
<div id="variables" class="d-none">
<table class="table table-borderless">
<thead>
<th>Variable</th>
Expand Down
9 changes: 8 additions & 1 deletion src/playground.ts
Original file line number Diff line number Diff line change
Expand Up @@ -648,9 +648,10 @@ function updateVariableStorageDisplay(storage: yarnspinner.IVariableStorage) {
let variableTable = document.getElementById("variables");

// Make the variables view visible now
variableTable.classList.remove("d-none");
let variableTableBody = document.getElementById("variables-body");

let anyVariablesVisible = false;

// Remove all entries from the variables list
while (variableTableBody.firstChild) {
variableTableBody.removeChild(variableTableBody.firstChild);
Expand All @@ -662,6 +663,8 @@ function updateVariableStorageDisplay(storage: yarnspinner.IVariableStorage) {
continue;
}

anyVariablesVisible = true;

let variable = storage.getValue(variableName);

let row = document.createElement("tr");
Expand All @@ -680,4 +683,8 @@ function updateVariableStorageDisplay(storage: yarnspinner.IVariableStorage) {
variableValueCol.innerText = variable.toString();
}
}

if (anyVariablesVisible) {
variableTable.classList.remove("d-none");
}
}

0 comments on commit 8c29216

Please sign in to comment.