BlueSky & more on desktop lazurite.stormlightlabs.org/
tauri rust typescript bluesky appview atproto solid
2
fork

Configure Feed

Select the types of activity you want to include in your feed.

feat: post facet type guard

+8 -4
+2 -1
src/components/feeds/PostCard.tsx
··· 8 8 getAvatarLabel, 9 9 getDisplayName, 10 10 getPostCreatedAt, 11 + getPostFacets, 11 12 getPostText, 12 13 getQuotedAuthor, 13 14 getQuotedHref, ··· 182 183 profileHref={profileHref()} 183 184 post={props.post} /> 184 185 185 - <PostBodyText facets={props.post.record.facets} text={postText()} /> 186 + <PostBodyText facets={getPostFacets(props.post)} text={postText()} /> 186 187 187 188 <PostEmbeds post={props.post} /> 188 189 </PostPrimaryRegion>
+5
src/lib/feeds.ts
··· 103 103 return typeof text === "string" ? text : ""; 104 104 } 105 105 106 + export function getPostFacets(post: PostView) { 107 + const facets = asPostRecord(post.record).facets; 108 + return Array.isArray(facets) ? facets : []; 109 + } 110 + 106 111 export function getPostCreatedAt(post: PostView) { 107 112 const createdAt = post.record.createdAt; 108 113 return typeof createdAt === "string" ? createdAt : post.indexedAt;
+1 -3
tsconfig.json
··· 18 18 "noUnusedParameters": true, 19 19 "noFallthroughCasesInSwitch": true, 20 20 "types": ["vite/client", "@testing-library/jest-dom"], 21 - "baseUrl": "src", 22 - "ignoreDeprecations": "6.0", 23 - "paths": { "$/*": ["./*"] } 21 + "paths": { "$/*": ["./src/*"] } 24 22 }, 25 23 "include": ["src"], 26 24 "references": [{ "path": "./tsconfig.node.json" }]