Fix duplicate replies in post details and remove sticky header
This commit is contained in:
@@ -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,
|
||||
|
||||
@@ -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"
|
||||
|
||||
Reference in New Issue
Block a user