From f56b06f335b70c3efc7e3914a4b757e063e1adff Mon Sep 17 00:00:00 2001 From: irvin <7606712+Osyna@users.noreply.github.com> Date: Mon, 10 Aug 2026 10:46:36 +0200 Subject: [PATCH 1/7] Fix friend place-count bug, relocate Recently Deleted, chunk-render My Places MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Real bug found & fixed: friends.js used Prisma's bare _count.places to show 'N places' on friend cards / requests — that count had NO deletedAt filter, unlike every other places query, so it silently included soft-deleted places and over-reported a friend's real place count. Fixed by filtering the relation count (_count.places.where); verified end-to-end: badge correctly drops 3 -> 2 after a soft-delete (would have stayed 3 with the bug). Recently Deleted UX: moved from a section at the very bottom of a 541-card list (had to scroll past everything to reach it) to a dedicated icon button in the header, right next to Select, with a badge for pending count. Opens a floating panel (same pattern as the map's legend card) instead of pushing the list down. Dynamic (chunked) rendering for My Places: mounting all 541 cards at once (icons, stars, tag lists, thumbnails, and a sortedPlaces computed that re-filters/sorts on every GPS update) was the actual render-lag source. Now only a window of 60 cards is in the DOM, grown by 60 via an IntersectionObserver sentinel as the user scrolls — verified 60 initial -> 420 after scrolling. Search, header count and category chips are untouched (always computed over the FULL in-memory array, never the render window): verified 'All (541)' stays correct and a search for a place NOT among the initial 60 rendered cards is found instantly ('Grizzly' -> found, full-dataset Fuse search unaffected). --- server/routes/friends.js | 2 +- src/components/PlacesView.vue | 145 ++++++++++++++++++++++------------ src/styles/cartoon.scss | 132 +++++++++++++++++++++++-------- 3 files changed, 194 insertions(+), 85 deletions(-) diff --git a/server/routes/friends.js b/server/routes/friends.js index 6a0031c..cbe8353 100644 --- a/server/routes/friends.js +++ b/server/routes/friends.js @@ -13,7 +13,7 @@ const requestLimiter = rateLimit({ const FRIEND_SELECT = { id: true, name: true, handle: true, bio: true, country: true, favoriteCuisines: true, - _count: { select: { places: true } }, + _count: { select: { places: { where: { deletedAt: null } } } }, } export default function friendsRoutes(prisma) { diff --git a/src/components/PlacesView.vue b/src/components/PlacesView.vue index 2324f82..43bf087 100644 --- a/src/components/PlacesView.vue +++ b/src/components/PlacesView.vue @@ -1,5 +1,5 @@