diff --git a/src/components/CannedMessagesPanel.tsx b/src/components/CannedMessagesPanel.tsx index fff1709..a1fb40b 100644 --- a/src/components/CannedMessagesPanel.tsx +++ b/src/components/CannedMessagesPanel.tsx @@ -32,14 +32,21 @@ export function CannedMessagesPanel({ compact, onSelect }: CannedMessagesPanelPr const [newContent, setNewContent] = useState(""); const [error, setError] = useState(""); + useEffect(() => { + let cancelled = false; + (async () => { + const data = await loadCannedMessages(user?.id); + if (!cancelled) setMessages(data); + })(); + return () => { + cancelled = true; + }; + }, [user?.id]); + const refresh = async () => { setMessages(await loadCannedMessages(user?.id)); }; - useEffect(() => { - refresh(); - }, [user?.id]); - const startEdit = (msg: CannedMessage) => { setEditing(msg.id); setEditTitle(msg.title); diff --git a/src/components/PhotoGalleryManager.tsx b/src/components/PhotoGalleryManager.tsx index 6d4520b..f0e101b 100644 --- a/src/components/PhotoGalleryManager.tsx +++ b/src/components/PhotoGalleryManager.tsx @@ -42,6 +42,21 @@ export function PhotoGalleryManager({ onVerifyClick }: PhotoGalleryManagerProps) const fileRef = useRef(null); const blurExplicit = mustBlurExplicit(profile?.id_verified); + useEffect(() => { + let cancelled = false; + (async () => { + const data = await loadGallery(user?.id); + if (!cancelled) { + setAlbums(data.albums); + setPhotos(data.photos); + setLoading(false); + } + })(); + return () => { + cancelled = true; + }; + }, [user?.id]); + const refresh = async () => { const data = await loadGallery(user?.id); setAlbums(data.albums); @@ -49,10 +64,6 @@ export function PhotoGalleryManager({ onVerifyClick }: PhotoGalleryManagerProps) setLoading(false); }; - useEffect(() => { - refresh(); - }, [user?.id]); - const albumPhotos = photos.filter( (p) => activeAlbum === "main" diff --git a/src/components/ui/dialog.tsx b/src/components/ui/dialog.tsx index da9bd4e..8b185a3 100644 --- a/src/components/ui/dialog.tsx +++ b/src/components/ui/dialog.tsx @@ -61,4 +61,26 @@ const DialogTitle = React.forwardRef< )); DialogTitle.displayName = DialogPrimitive.Title.displayName; -export { Dialog, DialogPortal, DialogOverlay, DialogTrigger, DialogClose, DialogContent, DialogHeader, DialogTitle }; \ No newline at end of file +const DialogDescription = React.forwardRef< + React.ElementRef, + React.ComponentPropsWithoutRef +>(({ className, ...props }, ref) => ( + +)); +DialogDescription.displayName = DialogPrimitive.Description.displayName; + +export { + Dialog, + DialogPortal, + DialogOverlay, + DialogTrigger, + DialogClose, + DialogContent, + DialogHeader, + DialogTitle, + DialogDescription, +}; \ No newline at end of file