your personal website on atproto - mirror blento.app

fix invalid handle

Florian 02917554 cf7ab30f

+14 -2
+5 -1
src/lib/atproto/methods.ts
··· 93 params: { actor: data.did } 94 }); 95 96 - if (!response.ok) return; 97 98 return response.data; 99 }
··· 93 params: { actor: data.did } 94 }); 95 96 + if (!response.ok || response.data.handle === 'handle.invalid') { 97 + // fall back to describe repo 98 + const repo = await describeRepo({ did: data.did, client: data.client }); 99 + return { handle: repo?.handle ?? 'handle.invalid', did: data.did }; 100 + } 101 102 return response.data; 103 }
+9 -1
src/lib/cards/SpecialCards/UpdatedBlentos/index.ts
··· 30 for (const did of Array.from(uniqueDids)) { 31 const profile = getDetailedProfile({ did }); 32 profiles.push(profile); 33 - if (profiles.length > 20) break; 34 } 35 36 const result = [...(await Promise.all(profiles)), ...existingUsersArray];
··· 30 for (const did of Array.from(uniqueDids)) { 31 const profile = getDetailedProfile({ did }); 32 profiles.push(profile); 33 + if (profiles.length > 30) break; 34 + } 35 + 36 + for (let i = existingUsersArray.length - 1; i >= 0; i--) { 37 + // if handle is handle.invalid, remove from existing users and add to profiles to refresh 38 + if (existingUsersArray[i].handle === 'handle.invalid') { 39 + const removed = existingUsersArray.splice(i, 1)[0]; 40 + profiles.push(getDetailedProfile({ did: removed.did })); 41 + } 42 } 43 44 const result = [...(await Promise.all(profiles)), ...existingUsersArray];