mirror of
https://github.com/penpot/penpot.git
synced 2025-07-31 23:19:30 +02:00
🐛 Fix incorrect handling of user lang selection.
That causes double loading of the http resources in some circumstances.
This commit is contained in:
parent
a92820e910
commit
464a686c04
3 changed files with 16 additions and 15 deletions
|
@ -79,11 +79,6 @@
|
||||||
|
|
||||||
(defn init-ui
|
(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 ui/app) (dom/get-element "app"))
|
||||||
(mf/mount (mf/element modal) (dom/get-element "modal")))
|
(mf/mount (mf/element modal) (dom/get-element "modal")))
|
||||||
|
|
||||||
|
@ -92,7 +87,12 @@
|
||||||
(i18n/init! cfg/translations)
|
(i18n/init! cfg/translations)
|
||||||
(theme/init! cfg/themes)
|
(theme/init! cfg/themes)
|
||||||
(st/init)
|
(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
|
(defn reinit
|
||||||
[]
|
[]
|
||||||
|
|
|
@ -265,19 +265,19 @@
|
||||||
|
|
||||||
(mf/defc viewer-page
|
(mf/defc viewer-page
|
||||||
[{:keys [file-id page-id index token section] :as props}]
|
[{: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)
|
(let [data (mf/deref refs/viewer-data)
|
||||||
state (mf/deref refs/viewer-local)]
|
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/use-effect
|
||||||
(mf/deps (:file data))
|
(mf/deps (:file data))
|
||||||
#(when (:file data)
|
#(when-let [name (get-in data [:file :name])]
|
||||||
(dom/set-html-title (tr "title.viewer"
|
(dom/set-html-title (tr "title.viewer" name))))
|
||||||
(get-in data [:file :name])))))
|
|
||||||
|
|
||||||
(when (and data state)
|
(when (and data state)
|
||||||
[:& viewer-content
|
[:& viewer-content
|
||||||
|
|
|
@ -73,6 +73,7 @@
|
||||||
(swap! storage assoc ::locale lang)
|
(swap! storage assoc ::locale lang)
|
||||||
(reset! locale lang))
|
(reset! locale lang))
|
||||||
(do
|
(do
|
||||||
|
(swap! storage dissoc ::locale)
|
||||||
(reset! locale (autodetect)))))
|
(reset! locale (autodetect)))))
|
||||||
|
|
||||||
(defn reset-locale
|
(defn reset-locale
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue