MCPcopy Create free account
hub / github.com/dailydotdev/apps / getFeedItemKey

Function getFeedItemKey

packages/shared/src/components/FeedItemComponent.tsx:116–129  ·  view source on GitHub ↗
(item: FeedItem, index: number)

Source from the content-addressed store, hash-verified

114 Pick<UseBookmarkPost, 'toggleBookmark'>;
115
116export function getFeedItemKey(item: FeedItem, index: number): string {
117 switch (item.type) {
118 case 'post':
119 return item.post.id;
120 case 'highlight':
121 return getHighlightIdsKey(item.highlights) || `highlight-${index}`;
122 case 'ad':
123 return `ad-${index}`;
124 case 'widget':
125 return `widget-${item.widget.id}`;
126 default:
127 return `placeholder-${index}`;
128 }
129}
130
131const getPostTypeForCard = (post?: Post): PostType => {
132 if (!post) {

Callers 1

FeedFunction · 0.90

Calls 1

getHighlightIdsKeyFunction · 0.90

Tested by

no test coverage detected