diff --git a/app/javascript/controllers/bar_controller.js b/app/javascript/controllers/bar_controller.js index db6dd008b..5ceed089c 100644 --- a/app/javascript/controllers/bar_controller.js +++ b/app/javascript/controllers/bar_controller.js @@ -19,8 +19,10 @@ export default class extends Controller { this.#clearTurboFrame() this.#showItem(this.buttonsContainerTarget) - this.#hideItem(this.askInputTarget) this.#hideItem(this.searchInputTarget) + if (this.hasAskInputTarget) { + this.#hideItem(this.askInputTarget) + } } showModalAndSubmit(event) { @@ -40,8 +42,10 @@ export default class extends Controller { this.#openInTurboFrame(this.searchUrlValue) this.#showItem(this.searchInputTarget) - this.#hideItem(this.askInputTarget) this.#hideItem(this.buttonsContainerTarget) + if (this.hasAskInputTarget) { + this.#hideItem(this.askInputTarget) + } } ask(event) {