Fix duplicate replies in post details and remove sticky header

This commit is contained in:
Chad Curtis
2026-02-22 17:46:15 -06:00
parent 24c577e152
commit 8ab67882f1
2 changed files with 10 additions and 2 deletions
+9 -1
View File
@@ -16,8 +16,16 @@ export function useReplies(eventId: string | undefined) {
{ signal: AbortSignal.any([signal, AbortSignal.timeout(5000)]) },
);
// Deduplicate events (multiple relays may return the same event)
const seen = new Set<string>();
const unique = events.filter((e) => {
if (seen.has(e.id)) return false;
seen.add(e.id);
return true;
});
// Sort oldest first for threaded conversation view
return events.sort((a, b) => a.created_at - b.created_at);
return unique.sort((a, b) => a.created_at - b.created_at);
},
enabled: !!eventId,
staleTime: 30 * 1000,
+1 -1
View File
@@ -326,7 +326,7 @@ function PostDetailShell({ children }: { children: React.ReactNode }) {
return (
<main className="flex-1 min-w-0 sidebar:max-w-[600px] sidebar:border-l xl:border-r border-border min-h-screen">
{/* Header — matches Ditto: ← Post Details */}
<div className="sidebar:sticky sidebar:top-0 z-10 flex items-center gap-4 px-4 mt-4 mb-5 bg-background/80 backdrop-blur-md">
<div className="flex items-center gap-4 px-4 mt-4 mb-5">
<button
onClick={() => navigate(-1)}
className="p-1.5 -ml-1.5 rounded-full hover:bg-secondary/60 transition-colors"