From 2bbc3e9779ad62dd13c7a5f73dbd400df9f71ab3 Mon Sep 17 00:00:00 2001 From: Rudy Fraser Date: Thu, 25 Jun 2026 14:46:36 -0400 Subject: [PATCH] fix(community): reconcile ported community-post code with post-upstream-merge main --- src/components/CommunityFeed.tsx | 8 ++++---- src/lib/api/index.ts | 1 + src/screens/Profile/Sections/CommunityFeed.tsx | 3 ++- src/state/queries/post.ts | 6 ------ src/state/queries/profile.ts | 9 --------- src/view/com/composer/Composer.tsx | 4 ++-- src/view/com/feeds/CommunityFeedPage.tsx | 11 ++++++----- 7 files changed, 15 insertions(+), 27 deletions(-) diff --git a/src/components/CommunityFeed.tsx b/src/components/CommunityFeed.tsx index 30fec5a58..32000df39 100644 --- a/src/components/CommunityFeed.tsx +++ b/src/components/CommunityFeed.tsx @@ -1,11 +1,11 @@ -import React from 'react' +import {useMemo} from 'react' import {ActivityIndicator, View} from 'react-native' import { type AppBskyFeedDefs, type AppBskyFeedPost, RichText as RichTextAPI, } from '@atproto/api' -import {Trans} from '@lingui/macro' +import {Trans} from '@lingui/react/macro' import {useCommunityFeedQuery} from '#/state/queries/community-feed' import {TimeElapsed} from '#/view/com/util/TimeElapsed' @@ -42,7 +42,7 @@ export function CommunityFeed({actor}: {actor: string}) { ) } - const feedItems = data?.pages.flatMap(page => page.feed) || [] + const feedItems = data?.pages.flatMap(page => page.feed ?? []) || [] if (feedItems.length === 0) { return ( @@ -88,7 +88,7 @@ export function CommunityPostItem({ }) { const t = useTheme() const record = postView.record as AppBskyFeedPost.Record - const rt = React.useMemo(() => { + const rt = useMemo(() => { const richText = new RichTextAPI({ text: record.text, facets: record.facets, diff --git a/src/lib/api/index.ts b/src/lib/api/index.ts index f382bff01..762cafe57 100644 --- a/src/lib/api/index.ts +++ b/src/lib/api/index.ts @@ -8,6 +8,7 @@ import { type AppBskyEmbedVideo, AppBskyFeedPost, type AtpAgent, + AtUri, BlobRef, ChatBskyGroupDefs, type ComAtprotoLabelDefs, diff --git a/src/screens/Profile/Sections/CommunityFeed.tsx b/src/screens/Profile/Sections/CommunityFeed.tsx index 297435129..6a0a26a19 100644 --- a/src/screens/Profile/Sections/CommunityFeed.tsx +++ b/src/screens/Profile/Sections/CommunityFeed.tsx @@ -5,8 +5,9 @@ import { type ListRenderItemInfo, View, } from 'react-native' -import {msg, Trans} from '@lingui/macro' +import {msg} from '@lingui/core/macro' import {useLingui} from '@lingui/react' +import {Trans} from '@lingui/react/macro' import { type HydratedCommunityPost, diff --git a/src/state/queries/post.ts b/src/state/queries/post.ts index d12f33daa..feb9659c9 100644 --- a/src/state/queries/post.ts +++ b/src/state/queries/post.ts @@ -17,12 +17,6 @@ import {useAnalytics} from '#/analytics' import {type Metrics, toClout} from '#/analytics/metrics' import {useIsThreadMuted, useSetThreadMute} from '../cache/thread-mutes' import {findProfileQueryData} from './profile' -import { - fetchQueryWithFallback, - useMutation, - useQuery, - useQueryClient, -} from './useQueryWithFallback' const RQKEY_ROOT = 'post' export const RQKEY = (postUri: string) => [RQKEY_ROOT, postUri] diff --git a/src/state/queries/profile.ts b/src/state/queries/profile.ts index 2f5a70ec6..a27b3f1f4 100644 --- a/src/state/queries/profile.ts +++ b/src/state/queries/profile.ts @@ -48,15 +48,6 @@ import { import {RQKEY_ROOT as RQKEY_LIST_CONVOS} from './messages/list-conversations' import {RQKEY as RQKEY_MY_BLOCKED} from './my-blocked-accounts' import {RQKEY as RQKEY_MY_MUTED} from './my-muted-accounts' -import { - type InfiniteData, - keepPreviousData, - prefetchQueryWithFallback, - type QueryClient, - useMutation, - useQuery, - useQueryClient, -} from './useQueryWithFallback' export * from '#/state/queries/unstable-profile-cache' /** diff --git a/src/view/com/composer/Composer.tsx b/src/view/com/composer/Composer.tsx index 6970bf0d0..76ff92868 100644 --- a/src/view/com/composer/Composer.tsx +++ b/src/view/com/composer/Composer.tsx @@ -1961,7 +1961,7 @@ function ComposerPills({ bottomBarAnimatedStyle: StyleProp }) { const t = useTheme() - const {_} = useLingui() + const {t: l} = useLingui() const media = post.embed.media const hasMedia = media?.type === 'images' || @@ -2004,7 +2004,7 @@ function ComposerPills({ {isReply ? null : ( { dispatch({type: 'toggle_blacksky_only'}) diff --git a/src/view/com/feeds/CommunityFeedPage.tsx b/src/view/com/feeds/CommunityFeedPage.tsx index 842d6676d..65b84865d 100644 --- a/src/view/com/feeds/CommunityFeedPage.tsx +++ b/src/view/com/feeds/CommunityFeedPage.tsx @@ -1,11 +1,12 @@ import {useCallback, useMemo, useRef} from 'react' import {ActivityIndicator, type ListRenderItemInfo, View} from 'react-native' -import {msg, Trans} from '@lingui/macro' +import {msg} from '@lingui/core/macro' import {useLingui} from '@lingui/react' +import {Trans} from '@lingui/react/macro' import {useOpenComposer} from '#/lib/hooks/useOpenComposer' -import {ComposeIcon2} from '#/lib/icons' import {s} from '#/lib/styles' +import {EditBig_Stroke2_Corner2_Rounded as EditBigIcon} from '#/components/icons/EditBig' import { type HydratedCommunityPost, useCommunityFeedHydrated, @@ -14,7 +15,7 @@ import { import {useSession} from '#/state/session' import {PostFeedItem} from '#/view/com/posts/PostFeedItem' import {FAB} from '#/view/com/util/fab/FAB' -import {List} from '#/view/com/util/List' +import {List, type ListMethods} from '#/view/com/util/List' import {MainScrollProvider} from '#/view/com/util/MainScrollProvider' import {atoms as a, useTheme} from '#/alf' import {useHeaderOffset} from '#/components/hooks/useHeaderOffset' @@ -26,7 +27,7 @@ export function CommunityFeedPage({isPageFocused}: {isPageFocused: boolean}) { const t = useTheme() const {hasSession} = useSession() const headerOffset = useHeaderOffset() - const scrollElRef = useRef(null) + const scrollElRef = useRef(null) const {openComposer} = useOpenComposer() const onPressCompose = useCallback(() => { @@ -162,7 +163,7 @@ export function CommunityFeedPage({isPageFocused}: {isPageFocused: boolean}) { } + icon={} accessibilityRole="button" accessibilityLabel={_(msg`New post`)} accessibilityHint="" -- knotmirror 0.0.1