···33import { cookies } from "next/headers";
44import { supabaseServerClient } from "supabase/serverClient";
55import { cache } from "react";
66+import { deduplicateByUri } from "src/utils/deduplicateRecords";
67export const getIdentityData = cache(uncachedGetIdentityData);
78export async function uncachedGetIdentityData() {
89 let cookieStore = await cookies();
···4445 if (!auth_res?.data?.identities) return null;
4546 if (auth_res.data.identities.atp_did) {
4647 //I should create a relationship table so I can do this in the above query
4747- let { data: publications } = await supabaseServerClient
4848+ let { data: rawPublications } = await supabaseServerClient
4849 .from("publications")
4950 .select("*")
5051 .eq("identity_did", auth_res.data.identities.atp_did);
5252+ // Deduplicate records that may exist under both pub.leaflet and site.standard namespaces
5353+ const publications = deduplicateByUri(rawPublications || []);
5154 return {
5255 ...auth_res.data.identities,
5353- publications: publications || [],
5656+ publications,
5457 };
5558 }
5659
+5-1
app/(home-pages)/discover/getPublications.ts
···55 normalizePublicationRow,
66 hasValidPublication,
77} from "src/utils/normalizeRecords";
88+import { deduplicateByUri } from "src/utils/deduplicateRecords";
89910export type Cursor = {
1011 indexed_at?: string;
···4243 return { publications: [], nextCursor: null };
4344 }
44454646+ // Deduplicate records that may exist under both pub.leaflet and site.standard namespaces
4747+ const dedupedPublications = deduplicateByUri(publications || []);
4848+4549 // Filter out publications without documents
4646- const allPubs = (publications || []).filter(
5050+ const allPubs = dedupedPublications.filter(
4751 (pub) => pub.documents_in_publications.length > 0,
4852 );
4953