Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 4 additions & 2 deletions src/Previewer/Previewer.js
Original file line number Diff line number Diff line change
Expand Up @@ -161,7 +161,7 @@ export default function Previewer({
if (settings.get_boolean("auto-preview")) schedule_update();
});
let symbols = null;
async function update(force = false) {
async function update(force = false, clearConsole = true) {
if (!(force || settings.get_boolean("auto-preview"))) return;
let text = panel_ui.xml.trim();
let target_id;
Expand Down Expand Up @@ -203,7 +203,9 @@ export default function Previewer({

registerSignals({ tree, scope, symbols, template });

term_console.clear();
if (clearConsole) {
term_console.clear();
}

try {
builder.add_from_string(text, -1);
Expand Down
5 changes: 3 additions & 2 deletions src/window.js
Original file line number Diff line number Diff line change
Expand Up @@ -329,6 +329,9 @@ export default function Window({ application, session }) {

previewer.start();
panel_ui.start();
// We already cleared the console before starting.
// We don't want to clear the console again, as this would hide compile errors if any occurred.
await previewer.update(true, false);

button_run.set_sensitive(true);
term_console.scrollToEnd();
Expand All @@ -345,8 +348,6 @@ export default function Window({ application, session }) {
}

if (language === "JavaScript") {
await previewer.update(true);

// We have to create a new file each time
// because gjs doesn't appear to use etag for module caching
// ?foo=Date.now() also does not work as expected
Expand Down