Refactor feed slices (#4834)
* Copy FeedViewPost into FeedSliceItem * Explicitly construct feed slice items by copying known fields * Type rootItem as FeedViewPost for now Mergefeed logic relies on that. * Unify reason and __source for slice items * Move feedContext out of FeedSliceItem * Remove slice.isFlattenedReply * Remove unnused slice.ts * Inline slice.isFullThread * Refactor condition for clarity * Extract slice.includesThreadRoot * Encapsulate more usages of slice.rootItem into slice * Rename slice.rootItem so semi-private slice._feedPost * Move reason into slice * Simplify slice ctor argument * Reorder getters to reduce diff * Make feedContext a getter to reduce diff
This commit is contained in:
parent
3914025227
commit
ac1538baad
3 changed files with 75 additions and 69 deletions
|
@ -314,7 +314,7 @@ export function usePostFeedQuery(
|
|||
if (isDiscover) {
|
||||
userActionHistory.seen(
|
||||
slice.items.map(item => ({
|
||||
feedContext: item.feedContext,
|
||||
feedContext: slice.feedContext,
|
||||
likeCount: item.post.likeCount ?? 0,
|
||||
repostCount: item.post.repostCount ?? 0,
|
||||
replyCount: item.post.replyCount ?? 0,
|
||||
|
@ -329,7 +329,7 @@ export function usePostFeedQuery(
|
|||
const feedPostSlice: FeedPostSlice = {
|
||||
_reactKey: slice._reactKey,
|
||||
_isFeedPostSlice: true,
|
||||
rootUri: slice.rootItem.post.uri,
|
||||
rootUri: slice.uri,
|
||||
isThread:
|
||||
slice.items.length > 1 &&
|
||||
slice.items.every(
|
||||
|
@ -365,11 +365,8 @@ export function usePostFeedQuery(
|
|||
uri: item.post.uri,
|
||||
post: item.post,
|
||||
record: item.post.record,
|
||||
reason:
|
||||
i === 0 && slice.source
|
||||
? slice.source
|
||||
: item.reason,
|
||||
feedContext: item.feedContext || slice.feedContext,
|
||||
reason: slice.reason,
|
||||
feedContext: slice.feedContext,
|
||||
moderation: moderations[i],
|
||||
parentAuthor,
|
||||
isParentBlocked,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue