diff --git a/package.json b/package.json index b75227e..b60f59e 100644 --- a/package.json +++ b/package.json @@ -1,7 +1,7 @@ { "name": "skate-spots", "private": true, - "version": "1.2.37", + "version": "1.2.38", "type": "module", "homepage": "https://skate-spots.com", "scripts": { diff --git a/src/hooks/useLabProfiles.ts b/src/hooks/useLabProfiles.ts index 2470d95..2f93173 100644 --- a/src/hooks/useLabProfiles.ts +++ b/src/hooks/useLabProfiles.ts @@ -149,7 +149,10 @@ export function useLabProfile(identifier: string, pubkey?: string) { } = { kinds: LAB_KINDS, '#d': [identifier], - limit: 1, + // Relays can hold multiple revisions of an addressable event; fetch a + // few and pick the newest rather than trusting whatever `limit: 1` + // returns (which may be a stale revision, dropping members/edits). + limit: 10, }; if (pubkey) filter.authors = [pubkey]; @@ -158,7 +161,12 @@ export function useLabProfile(identifier: string, pubkey?: string) { if (events.length === 0) return null; - return parseLabProfile(events[0]); + // Newest revision wins. + const newest = events.reduce((latest, current) => + current.created_at > latest.created_at ? current : latest, + ); + + return parseLabProfile(newest); }, enabled: !!identifier, staleTime: 30000,