🐛 Fix incorrect state management on webhooks crud

This commit is contained in:
Andrey Antukh 2023-02-01 10:06:27 +01:00
parent 91ececa59e
commit e8ea61ee78
3 changed files with 34 additions and 24 deletions

View file

@ -637,7 +637,9 @@
{::mf/register modal/components
::mf/register-as :webhook}
[{:keys [webhook] :as props}]
(let [initial (mf/use-memo (fn [] (or webhook {:is-active false :mtype "application/json"})))
;; FIXME: this is a workaround because input fields do not support rendering hooks
(let [initial (mf/use-memo (fn [] (or (some-> webhook (update :uri str))
{:is-active false :mtype "application/json"})))
form (fm/use-form :spec ::webhook-form
:initial initial)
on-success
@ -735,8 +737,6 @@
]
[:div.explain (tr "dashboard.webhooks.active.explain")]]]
[:div.modal-footer
[:div.action-buttons
[:input.cancel-button
@ -827,7 +827,7 @@
{:success? (nil? error-code)
:text last-delivery-text}]]]
[:div.table-field.uri
[:div (:uri webhook)]]
[:div (dm/str (:uri webhook))]]
[:div.table-field.active
[:div (if (:is-active webhook)
(tr "labels.active")