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

🐛 Fix new-file button on project not redirecting to the new file

This commit is contained in:
alonso.torres 2023-07-11 14:51:10 +02:00 committed by Aitor
parent 5631204567
commit 872648d393
2 changed files with 14 additions and 2 deletions

View file

@ -71,6 +71,7 @@
- Fix error screen on upload image error [Taiga #5608](https://tree.taiga.io/project/penpot/issue/5608)
- Fix bad frame-id for certain componentes [#3205](https://github.com/penpot/penpot/issues/3205)
- Fix paste elements at bottom of frame [Taig #5253](https://tree.taiga.io/project/penpot/issue/5253)
- Fix new-file button on project not redirecting to the new file [Taiga #5610](https://tree.taiga.io/project/penpot/issue/5610)
### :arrow_up: Deps updates

View file

@ -18,6 +18,7 @@
[app.util.dom :as dom]
[app.util.i18n :as i18n :refer [tr]]
[app.util.keyboard :as kbd]
[app.util.router :as rt]
[app.util.webapi :as wapi]
[beicon.core :as rx]
[cuerdas.core :as str]
@ -142,12 +143,22 @@
(sort-by :modified-at)
(reverse)))
on-file-created
(mf/use-fn
(fn [data]
(let [pparams {:project-id (:project-id data)
:file-id (:id data)}
qparams {:page-id (get-in data [:data :pages 0])}]
(st/emit! (rt/nav :workspace pparams qparams)))))
create-file
(mf/use-fn
(mf/deps project)
(fn [origin]
(st/emit! (with-meta (dd/create-file {:project-id (:id project)})
{::ev/origin origin}))))]
(let [mdata {:on-success on-file-created}
params {:project-id (:id project)}]
(st/emit! (-> (dd/create-file (with-meta params mdata))
(with-meta {::ev/origin origin}))))))]
(mf/with-effect []
(let [node (mf/ref-val rowref)