mirror of
https://github.com/penpot/penpot.git
synced 2025-06-09 23:21:37 +02:00
🐛 Fix problem with error reporting screen
This commit is contained in:
parent
1c38883ddd
commit
38148cf87f
1 changed files with 43 additions and 38 deletions
|
@ -69,6 +69,7 @@
|
||||||
|
|
||||||
(defn generate-report
|
(defn generate-report
|
||||||
[data]
|
[data]
|
||||||
|
(try
|
||||||
(let [team-id (:current-team-id @st/state)
|
(let [team-id (:current-team-id @st/state)
|
||||||
profile-id (:profile-id @st/state)
|
profile-id (:profile-id @st/state)
|
||||||
|
|
||||||
|
@ -108,8 +109,10 @@
|
||||||
(pp/pprint @st/last-events {:length 200})
|
(pp/pprint @st/last-events {:length 200})
|
||||||
|
|
||||||
(println))]
|
(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
|
(mf/defc internal-error
|
||||||
|
@ -117,6 +120,7 @@
|
||||||
[{:keys [data]}]
|
[{:keys [data]}]
|
||||||
(let [on-click (mf/use-fn #(st/emit! (rt/assign-exception nil)))
|
(let [on-click (mf/use-fn #(st/emit! (rt/assign-exception nil)))
|
||||||
report-uri (mf/use-ref nil)
|
report-uri (mf/use-ref nil)
|
||||||
|
report (mf/use-memo (mf/deps data) #(generate-report data))
|
||||||
|
|
||||||
on-download
|
on-download
|
||||||
(mf/use-fn
|
(mf/use-fn
|
||||||
|
@ -125,17 +129,18 @@
|
||||||
(when-let [uri (mf/ref-val report-uri)]
|
(when-let [uri (mf/ref-val report-uri)]
|
||||||
(dom/trigger-download-uri "report" "text/plain" uri))))]
|
(dom/trigger-download-uri "report" "text/plain" uri))))]
|
||||||
|
|
||||||
(mf/with-effect [data]
|
(mf/with-effect [report]
|
||||||
(let [report (generate-report data)
|
(when (some? report)
|
||||||
uri (wapi/create-uri report)]
|
(let [uri (wapi/create-uri report)]
|
||||||
(mf/set-ref-val! report-uri uri)
|
(mf/set-ref-val! report-uri uri)
|
||||||
(fn []
|
(fn []
|
||||||
(wapi/revoke-uri uri))))
|
(wapi/revoke-uri uri)))))
|
||||||
|
|
||||||
[:> error-container {}
|
[:> error-container {}
|
||||||
[:div {:class (stl/css :main-message)} (tr "labels.internal-error.main-message")]
|
[:div {:class (stl/css :main-message)} (tr "labels.internal-error.main-message")]
|
||||||
[:div {:class (stl/css :desc-message)} (tr "labels.internal-error.desc-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)}
|
[:div {:class (stl/css :sign-info)}
|
||||||
[:button {:on-click on-click} (tr "labels.retry")]]]))
|
[:button {:on-click on-click} (tr "labels.retry")]]]))
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue