From 7d68d79fc34b0561ef8a337d3d545d69f4799207 Mon Sep 17 00:00:00 2001 From: "alonso.torres" Date: Mon, 29 Mar 2021 10:26:34 +0200 Subject: [PATCH] :bug: Fix issue with recent files not showing --- CHANGES.md | 1 + backend/src/app/rpc/queries/recent_files.clj | 2 +- frontend/src/app/main/ui/dashboard/grid.cljs | 13 ++++++++----- 3 files changed, 10 insertions(+), 6 deletions(-) diff --git a/CHANGES.md b/CHANGES.md index fc6beeb52..6aa1b1c26 100644 --- a/CHANGES.md +++ b/CHANGES.md @@ -59,6 +59,7 @@ - Fix issue with typographies panel cannot be collapsed [#707](https://github.com/penpot/penpot/issues/707) - Fix text selection in comments [#745](https://github.com/penpot/penpot/issues/745) - Update Work-Sans font [#744](https://github.com/penpot/penpot/issues/744) +- Fix issue with recent files not showing [Taiga #1493](https://tree.taiga.io/project/penpot/issue/1493) ### :arrow_up: Deps updates diff --git a/backend/src/app/rpc/queries/recent_files.clj b/backend/src/app/rpc/queries/recent_files.clj index 1791b784b..e4f9b6b1f 100644 --- a/backend/src/app/rpc/queries/recent_files.clj +++ b/backend/src/app/rpc/queries/recent_files.clj @@ -27,7 +27,7 @@ window w as (partition by f.project_id order by f.modified_at desc) order by f.modified_at desc ) - select * from recent_files where row_num <= 6;") + select * from recent_files where row_num <= 10;") (s/def ::team-id ::us/uuid) (s/def ::profile-id ::us/uuid) diff --git a/frontend/src/app/main/ui/dashboard/grid.cljs b/frontend/src/app/main/ui/dashboard/grid.cljs index a7653c3f5..7c8f7b555 100644 --- a/frontend/src/app/main/ui/dashboard/grid.cljs +++ b/frontend/src/app/main/ui/dashboard/grid.cljs @@ -256,14 +256,17 @@ itemsize 290 ratio (if (some? @width) (/ @width itemsize) 0) nitems (mth/floor ratio) - limit (if (and (some? @width) - (> (* itemsize (count files)) @width) - (< (- ratio nitems) 0.51)) - (dec nitems) ;; Leave space for the "show all" block - nitems) + limit (min 10 ;; Configuration in backend to return recent files + (if (and (some? @width) + (> (* itemsize (count files)) @width) + (< (- ratio nitems) 0.51)) + (dec nitems) ;; Leave space for the "show all" block + nitems)) + limit (if dragging? (dec limit) limit) + limit (max 1 limit)] (mf/use-effect