0
Fork 0
mirror of https://github.com/penpot/penpot.git synced 2025-02-03 21:09:00 -05:00

🐛 Fix problem with error reporting screen

This commit is contained in:
alonso.torres 2024-03-05 09:51:22 +01:00
parent 1c38883ddd
commit 38148cf87f

View file

@ -69,6 +69,7 @@
(defn generate-report
[data]
(try
(let [team-id (:current-team-id @st/state)
profile-id (:profile-id @st/state)
@ -108,8 +109,10 @@
(pp/pprint @st/last-events {:length 200})
(println))]
(wapi/create-blob content "text/plain")))
(wapi/create-blob content "text/plain"))
(catch :default err
(.error js/console err)
nil)))
(mf/defc internal-error
@ -117,6 +120,7 @@
[{:keys [data]}]
(let [on-click (mf/use-fn #(st/emit! (rt/assign-exception nil)))
report-uri (mf/use-ref nil)
report (mf/use-memo (mf/deps data) #(generate-report data))
on-download
(mf/use-fn
@ -125,17 +129,18 @@
(when-let [uri (mf/ref-val report-uri)]
(dom/trigger-download-uri "report" "text/plain" uri))))]
(mf/with-effect [data]
(let [report (generate-report data)
uri (wapi/create-uri report)]
(mf/with-effect [report]
(when (some? report)
(let [uri (wapi/create-uri report)]
(mf/set-ref-val! report-uri uri)
(fn []
(wapi/revoke-uri uri))))
(wapi/revoke-uri uri)))))
[:> error-container {}
[:div {:class (stl/css :main-message)} (tr "labels.internal-error.main-message")]
[:div {:class (stl/css :desc-message)} (tr "labels.internal-error.desc-message")]
[:a {:on-click on-download} "Download report.txt"]
(when (some? report)
[:a {:on-click on-download} "Download report.txt"])
[:div {:class (stl/css :sign-info)}
[:button {:on-click on-click} (tr "labels.retry")]]]))