From 68503e8915d8fd0f1936249bf861e75436a62423 Mon Sep 17 00:00:00 2001 From: neodk2004 Date: Sat, 27 Jun 2026 07:47:41 +0200 Subject: [PATCH] fix(mobile+comments): #4 correct query invalidation key, #6 add viewport-fit=cover --- DEBUG-List.md | 2 +- src/app/layout.tsx | 8 +++++++- src/components/feed/PostDetailDialog.tsx | 13 ++++++++++--- 3 files changed, 18 insertions(+), 5 deletions(-) diff --git a/DEBUG-List.md b/DEBUG-List.md index 5d40ac3..1aa56fe 100644 --- a/DEBUG-List.md +++ b/DEBUG-List.md @@ -20,7 +20,7 @@ Debug: \-Mobilansicht - Impressum/Datenschutz in das Profil rein legen, damit man es erreichen kann. -\-Mobilansicht - Nachrichten nicht aufrufbar weil kein Button vorhanden. kann gerne als Mail-Icon mitscrollend oben rechts in die ecke damit es immer erreichbar ist. +~~\-Mobilansicht - Nachrichten nicht aufrufbar weil kein Button vorhanden. kann gerne als Mail-Icon mitscrollend oben rechts in die ecke damit es immer erreichbar ist.~~ ✅ ERLEDIGT diff --git a/src/app/layout.tsx b/src/app/layout.tsx index fac683b..0261436 100644 --- a/src/app/layout.tsx +++ b/src/app/layout.tsx @@ -1,4 +1,4 @@ -import type { Metadata } from "next"; +import type { Metadata, Viewport } from "next"; import { Inter } from "next/font/google"; import { ClerkProvider } from "@clerk/nextjs"; import { NextIntlClientProvider } from "next-intl"; @@ -18,6 +18,12 @@ export const metadata: Metadata = { description: "The social platform where pets are the stars.", }; +export const viewport: Viewport = { + width: "device-width", + initialScale: 1, + viewportFit: "cover", +}; + export default async function RootLayout({ children, }: Readonly<{ diff --git a/src/components/feed/PostDetailDialog.tsx b/src/components/feed/PostDetailDialog.tsx index c044d42..c8923fa 100644 --- a/src/components/feed/PostDetailDialog.tsx +++ b/src/components/feed/PostDetailDialog.tsx @@ -116,8 +116,11 @@ export function PostDetailDialog({ post, open, onClose, onDeleted }: PostDetailD trpc.comments.create.mutationOptions({ onSuccess: () => { setPendingBody(null); - void queryClient.invalidateQueries({ queryKey: [["trpc", "comments", "listByPost"]] }); - void queryClient.invalidateQueries({ queryKey: [["trpc", "feed", "getFeed"]] }); + if (post?.id) { + void queryClient.invalidateQueries({ + queryKey: trpc.comments.listByPost.queryOptions({ postId: post.id, limit: 50 }).queryKey, + }); + } setTimeout(() => commentsEndRef.current?.scrollIntoView({ behavior: "smooth" }), 150); }, onError: () => { @@ -131,7 +134,11 @@ export function PostDetailDialog({ post, open, onClose, onDeleted }: PostDetailD const deleteCommentMutation = useMutation( trpc.comments.delete.mutationOptions({ onSuccess: () => { - void queryClient.invalidateQueries({ queryKey: [["trpc", "comments", "listByPost"]] }); + if (post?.id) { + void queryClient.invalidateQueries({ + queryKey: trpc.comments.listByPost.queryOptions({ postId: post.id, limit: 50 }).queryKey, + }); + } }, onError: () => toast.error(tc("deleteError")), })