Skip to content

Commit

Permalink
fixes error when changing examples
Browse files Browse the repository at this point in the history
  • Loading branch information
joaovictor3g committed Apr 23, 2024
1 parent 946e607 commit c54aa66
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions web/assets/js/utils/render-functions.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ import { hideAccordions } from "../components/accordions/result.js";
import { localStorageModeKey } from "../constants.js";
import { AceEditor } from "../editor.js";
import { setEditorTheme } from "../theme.js";
import { getCurrentMode } from "./localStorage.js";

const examplesList = document.getElementById("examples");
const selectInstance = NiceSelect.bind(examplesList);
Expand Down Expand Up @@ -72,7 +73,7 @@ export function renderExamplesInSelectInstance(mode, examples) {
(example) => example.name === event.target.value
);
if (event.target.value === "Blank") {
const currentMode = localStorage.getItem(localStorageModeKey) ?? "cel";
const currentMode = getCurrentMode();
const exprEditor = new AceEditor(currentMode);
exprEditor.setValue("", -1);
setEditorTheme(exprEditor);
Expand All @@ -86,11 +87,12 @@ export function renderExamplesInSelectInstance(mode, examples) {
});
hideAccordions();
output.value = "";
} else {
if (!example) return;
handleFillExpressionContent(mode, example);
handleFillTabContent(mode, example);
}
if (!example) return;

handleFillExpressionContent(mode, example);
handleFillTabContent(mode, example);
setCost("");
output.value = "";
hideAccordions();
Expand Down

0 comments on commit c54aa66

Please sign in to comment.