0
Fork 0
mirror of https://github.com/penpot/penpot.git synced 2025-01-25 07:58:49 -05:00

🐛 Fix incorrect handling of user lang selection.

That causes double loading of the http resources
in some circumstances.
This commit is contained in:
Andrey Antukh 2021-04-13 09:46:36 +02:00
parent a92820e910
commit 464a686c04
3 changed files with 16 additions and 15 deletions

View file

@ -79,20 +79,20 @@
(defn init-ui
[]
(st/emit! (rt/initialize-router ui/routes)
(rt/initialize-history on-navigate))
(st/emit! (udu/fetch-profile)
(udu/fetch-user-teams))
(mf/mount (mf/element ui/app) (dom/get-element "app"))
(mf/mount (mf/element modal) (dom/get-element "modal")))
(mf/mount (mf/element modal) (dom/get-element "modal")))
(defn ^:export init
[]
(i18n/init! cfg/translations)
(theme/init! cfg/themes)
(st/init)
(init-ui))
(init-ui)
(st/emit! (rt/initialize-router ui/routes)
(rt/initialize-history on-navigate)
(udu/fetch-profile)
(udu/fetch-user-teams)))
(defn reinit
[]

View file

@ -265,19 +265,19 @@
(mf/defc viewer-page
[{:keys [file-id page-id index token section] :as props}]
(mf/use-effect
(mf/deps file-id page-id token)
(st/emitf (dv/initialize props)))
(let [data (mf/deref refs/viewer-data)
state (mf/deref refs/viewer-local)]
(mf/use-effect
(mf/deps file-id page-id token)
(fn []
(prn "viewer-page$use-effect")
(st/emit! (dv/initialize props))))
(mf/use-effect
(mf/deps (:file data))
#(when (:file data)
(dom/set-html-title (tr "title.viewer"
(get-in data [:file :name])))))
#(when-let [name (get-in data [:file :name])]
(dom/set-html-title (tr "title.viewer" name))))
(when (and data state)
[:& viewer-content

View file

@ -73,6 +73,7 @@
(swap! storage assoc ::locale lang)
(reset! locale lang))
(do
(swap! storage dissoc ::locale)
(reset! locale (autodetect)))))
(defn reset-locale