From 28659c12950c50ba4acca1931e35ebe1e4f63d43 Mon Sep 17 00:00:00 2001 From: Jason Zimdars Date: Wed, 7 May 2025 11:52:20 -0500 Subject: [PATCH] Clear error state when you start editing - It feels wrong to persist the error state while you're fixing the command --- app/javascript/controllers/terminal_controller.js | 4 ++++ app/views/commands/_form.html.erb | 2 +- 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/app/javascript/controllers/terminal_controller.js b/app/javascript/controllers/terminal_controller.js index 2b4d7bee2..65aaca9a3 100644 --- a/app/javascript/controllers/terminal_controller.js +++ b/app/javascript/controllers/terminal_controller.js @@ -28,6 +28,10 @@ export default class extends Controller { } } + hideError() { + this.element.classList.remove(this.errorClass) + } + async #handleErrorResponse(response) { const status = response.status const message = await response.text() diff --git a/app/views/commands/_form.html.erb b/app/views/commands/_form.html.erb index 46d2be019..ece1cc8ee 100644 --- a/app/views/commands/_form.html.erb +++ b/app/views/commands/_form.html.erb @@ -15,7 +15,7 @@ class: "terminal__input input fill-transparent unpad", data: { terminal_target: "input", - action: "keydown.up->toggle-class#add:prevent keydown.up->navigable-list#selectCurrentOrLast", + action: "keydown.up->toggle-class#add:prevent keydown.up->navigable-list#selectCurrentOrLast terminal#hideError", turbo_permanent: true }, placeholder: "Press ⌘+K to search or type commands…",