From 834e6efffcc1f6066e67a86be9ad6a570f0bb3dd Mon Sep 17 00:00:00 2001 From: chahinebrini Date: Fri, 22 May 2026 18:40:35 +0200 Subject: [PATCH] =?UTF-8?q?fix(chat/post):=20PostCard-Bilder-Ecken,=20Chat?= =?UTF-8?q?-Spinner-H=C3=A4nger,=20Bild-Cache?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - PostCard: Bilder mit borderRadius 10 + overflow:hidden — Ecken wieder rund - dm.tsx: myUserId synchron aus useAuthStore statt async getSession — behebt den hängenden Lade-Spinner beim Zurück aus einer Conversation (async getSession-Fenster auf jedem Mount → enabled-Flackern der Query) - ChatBubble: expo-image memory-disk-Cache + 200ms-Transition für smootheres Bild-Laden Co-Authored-By: Claude Opus 4.7 --- apps/rebreak-native/app/dm.tsx | 11 ++--------- apps/rebreak-native/components/PostCard.tsx | 4 ++-- apps/rebreak-native/components/chat/ChatBubble.tsx | 2 ++ 3 files changed, 6 insertions(+), 11 deletions(-) diff --git a/apps/rebreak-native/app/dm.tsx b/apps/rebreak-native/app/dm.tsx index e814816..6406012 100644 --- a/apps/rebreak-native/app/dm.tsx +++ b/apps/rebreak-native/app/dm.tsx @@ -16,13 +16,13 @@ import { Ionicons } from '@expo/vector-icons'; import { useQuery, useQueryClient } from '@tanstack/react-query'; import { useTranslation } from 'react-i18next'; import { apiFetch } from '../lib/api'; -import { supabase } from '../lib/supabase'; import { ChatBubble, type ChatMsg } from '../components/chat/ChatBubble'; import { ChatInput, type SendPayload } from '../components/chat/ChatInput'; import { DmChatBackground } from '../components/chat/DmChatBackground'; import { useDmRealtime } from '../hooks/useChatRealtime'; import { useColors } from '../lib/theme'; import { useThemeStore } from '../stores/theme'; +import { useAuthStore } from '../stores/auth'; import { UserAvatar } from '../components/UserAvatar'; import { ChatHeaderStatus } from '../components/chat/ChatHeaderStatus'; @@ -60,7 +60,7 @@ export default function DmScreen() { const styles = makeStyles(colors); const queryClient = useQueryClient(); const flatRef = useRef(null); - const [myUserId, setMyUserId] = useState(undefined); + const myUserId = useAuthStore((s) => s.user?.id); const colorScheme = useThemeStore((s) => s.colorScheme); const chatBg = colorScheme === 'dark' ? '#1a1f1e' : '#EDE8E1'; @@ -95,13 +95,6 @@ export default function DmScreen() { setReplyTo(null); }, [userId]); - // Lade meine User-ID - useEffect(() => { - supabase.auth.getSession().then(({ data }) => { - setMyUserId(data.session?.user.id); - }); - }, []); - // Lade DM-History — staleTime:0 erzwingt immer frischen Fetch (kein Cache-Hit-Bug) const { isLoading, isFetching } = useQuery({ queryKey: ['dm-history', userId], diff --git a/apps/rebreak-native/components/PostCard.tsx b/apps/rebreak-native/components/PostCard.tsx index 452bd39..fc05b53 100644 --- a/apps/rebreak-native/components/PostCard.tsx +++ b/apps/rebreak-native/components/PostCard.tsx @@ -315,8 +315,8 @@ function PostCardImpl({ post, onCommentPress }: Props) { setImageAspectRatio(Math.max(0.6, Math.min(1.78, ratio))); } }} - className="w-full rounded-xl mt-3" - style={{ aspectRatio: imageAspectRatio ?? 1.78 }} + className="w-full mt-3" + style={{ aspectRatio: imageAspectRatio ?? 1.78, borderRadius: 10, overflow: 'hidden' }} contentFit="cover" /> )} diff --git a/apps/rebreak-native/components/chat/ChatBubble.tsx b/apps/rebreak-native/components/chat/ChatBubble.tsx index 5e1bc3a..5227264 100644 --- a/apps/rebreak-native/components/chat/ChatBubble.tsx +++ b/apps/rebreak-native/components/chat/ChatBubble.tsx @@ -199,6 +199,8 @@ export function ChatBubble({ source={{ uri: msg.attachmentUrl }} style={styles.image} contentFit="cover" + cachePolicy="memory-disk" + transition={200} /> {isImageOnly && (