Shadow refactoring and improvements (#1959)
* Make shadow a type-only concept * Prevent unnecessary init state recalc * Use derived state instead of effects * Batch emitter updates * Use object first seen time instead of dataUpdatedAt * Stop threading dataUpdatedAt through * Use same value consistently
This commit is contained in:
@@ -76,7 +76,6 @@ let Feed = ({
|
||||
const opts = React.useMemo(() => ({enabled}), [enabled])
|
||||
const {
|
||||
data,
|
||||
dataUpdatedAt,
|
||||
isFetching,
|
||||
isFetched,
|
||||
isError,
|
||||
@@ -200,7 +199,6 @@ let Feed = ({
|
||||
return (
|
||||
<FeedSlice
|
||||
slice={item}
|
||||
dataUpdatedAt={dataUpdatedAt}
|
||||
// we check for this before creating the feedItems array
|
||||
moderationOpts={moderationOpts!}
|
||||
/>
|
||||
@@ -208,7 +206,6 @@ let Feed = ({
|
||||
},
|
||||
[
|
||||
feed,
|
||||
dataUpdatedAt,
|
||||
error,
|
||||
onPressTryAgain,
|
||||
onPressRetryLoadMore,
|
||||
|
||||
@@ -40,7 +40,6 @@ export function FeedItem({
|
||||
record,
|
||||
reason,
|
||||
moderation,
|
||||
dataUpdatedAt,
|
||||
isThreadChild,
|
||||
isThreadLastChild,
|
||||
isThreadParent,
|
||||
@@ -49,12 +48,11 @@ export function FeedItem({
|
||||
record: AppBskyFeedPost.Record
|
||||
reason: AppBskyFeedDefs.ReasonRepost | ReasonFeedSource | undefined
|
||||
moderation: PostModeration
|
||||
dataUpdatedAt: number
|
||||
isThreadChild?: boolean
|
||||
isThreadLastChild?: boolean
|
||||
isThreadParent?: boolean
|
||||
}) {
|
||||
const postShadowed = usePostShadow(post, dataUpdatedAt)
|
||||
const postShadowed = usePostShadow(post)
|
||||
const richText = useMemo(
|
||||
() =>
|
||||
new RichTextAPI({
|
||||
|
||||
@@ -11,12 +11,10 @@ import {makeProfileLink} from 'lib/routes/links'
|
||||
|
||||
let FeedSlice = ({
|
||||
slice,
|
||||
dataUpdatedAt,
|
||||
ignoreFilterFor,
|
||||
moderationOpts,
|
||||
}: {
|
||||
slice: FeedPostSlice
|
||||
dataUpdatedAt: number
|
||||
ignoreFilterFor?: string
|
||||
moderationOpts: ModerationOpts
|
||||
}): React.ReactNode => {
|
||||
@@ -44,7 +42,6 @@ let FeedSlice = ({
|
||||
record={slice.items[0].record}
|
||||
reason={slice.items[0].reason}
|
||||
moderation={moderations[0]}
|
||||
dataUpdatedAt={dataUpdatedAt}
|
||||
isThreadParent={isThreadParentAt(slice.items, 0)}
|
||||
isThreadChild={isThreadChildAt(slice.items, 0)}
|
||||
/>
|
||||
@@ -54,7 +51,6 @@ let FeedSlice = ({
|
||||
record={slice.items[1].record}
|
||||
reason={slice.items[1].reason}
|
||||
moderation={moderations[1]}
|
||||
dataUpdatedAt={dataUpdatedAt}
|
||||
isThreadParent={isThreadParentAt(slice.items, 1)}
|
||||
isThreadChild={isThreadChildAt(slice.items, 1)}
|
||||
/>
|
||||
@@ -65,7 +61,6 @@ let FeedSlice = ({
|
||||
record={slice.items[last].record}
|
||||
reason={slice.items[last].reason}
|
||||
moderation={moderations[last]}
|
||||
dataUpdatedAt={dataUpdatedAt}
|
||||
isThreadParent={isThreadParentAt(slice.items, last)}
|
||||
isThreadChild={isThreadChildAt(slice.items, last)}
|
||||
isThreadLastChild
|
||||
@@ -83,7 +78,6 @@ let FeedSlice = ({
|
||||
record={slice.items[i].record}
|
||||
reason={slice.items[i].reason}
|
||||
moderation={moderations[i]}
|
||||
dataUpdatedAt={dataUpdatedAt}
|
||||
isThreadParent={isThreadParentAt(slice.items, i)}
|
||||
isThreadChild={isThreadChildAt(slice.items, i)}
|
||||
isThreadLastChild={
|
||||
|
||||
Reference in New Issue
Block a user