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:
parent
1c38883ddd
commit
38148cf87f
1 changed files with 43 additions and 38 deletions
|
@ -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")]]]))
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue