From ebe9ed901de641dab0af7bccfc0331b33214ddc8 Mon Sep 17 00:00:00 2001 From: Eric Bailey Date: Fri, 6 Jun 2025 12:17:29 -0500 Subject: [PATCH] Update pkg and endpoint --- package.json | 2 +- src/state/queries/usePostThread/index.ts | 16 ++++++++-------- src/state/queries/usePostThread/queryCache.ts | 12 +++++------- src/state/queries/usePostThread/types.ts | 8 ++++---- yarn.lock | 8 ++++---- 5 files changed, 22 insertions(+), 24 deletions(-) diff --git a/package.json b/package.json index 6e5c3f37e5..d93433c88a 100644 --- a/package.json +++ b/package.json @@ -69,7 +69,7 @@ "icons:optimize": "svgo -f ./assets/icons" }, "dependencies": { - "@atproto/api": "^0.15.12", + "@atproto/api": "^0.15.13", "@bitdrift/react-native": "^0.6.8", "@braintree/sanitize-url": "^6.0.2", "@discord/bottom-sheet": "bluesky-social/react-native-bottom-sheet", diff --git a/src/state/queries/usePostThread/index.ts b/src/state/queries/usePostThread/index.ts index 8483ccd75c..4bf296ddc6 100644 --- a/src/state/queries/usePostThread/index.ts +++ b/src/state/queries/usePostThread/index.ts @@ -72,20 +72,20 @@ export function usePostThread({anchor}: {anchor?: string}) { * we could fetch once we hit the end. */ ctx.meta = ctx.meta || { - hasHiddenReplies: false, + hasOtherReplies: false, } /* * If we know we have additional replies, we'll set this to true. */ - if (data.hasHiddenReplies) { - ctx.meta.hasHiddenReplies = true + if (data.hasOtherReplies) { + ctx.meta.hasOtherReplies = true } const result = { thread: data.thread || [], threadgate: data.threadgate, - hasHiddenReplies: !!ctx.meta.hasHiddenReplies, + hasOtherReplies: !!ctx.meta.hasOtherReplies, } const record = getThreadgateRecord(result.threadgate) @@ -104,7 +104,7 @@ export function usePostThread({anchor}: {anchor?: string}) { * skeletons. */ const thread = placeholder ? [placeholder] : [] - return {thread, threadgate: undefined, hasHiddenReplies: false} + return {thread, threadgate: undefined, hasOtherReplies: false} }, select(data) { const record = getThreadgateRecord(data.threadgate) @@ -121,8 +121,8 @@ export function usePostThread({anchor}: {anchor?: string}) { [query.data?.threadgate], ) const hasOtherThreadItems = useMemo( - () => !!query.data?.hasHiddenReplies, - [query.data?.hasHiddenReplies], + () => !!query.data?.hasOtherReplies, + [query.data?.hasOtherReplies], ) const [otherItemsVisible, setOtherItemsVisible] = useState(false) @@ -152,7 +152,7 @@ export function usePostThread({anchor}: {anchor?: string}) { async queryFn() { const {data} = await wait( 400, - agent.app.bsky.unspecced.getPostThreadHiddenV2({ + agent.app.bsky.unspecced.getPostThreadOtherV2({ anchor: anchor!, prioritizeFollowedUsers, }), diff --git a/src/state/queries/usePostThread/queryCache.ts b/src/state/queries/usePostThread/queryCache.ts index 9cc54b22e9..8af7ec761f 100644 --- a/src/state/queries/usePostThread/queryCache.ts +++ b/src/state/queries/usePostThread/queryCache.ts @@ -2,7 +2,7 @@ import { type $Typed, type AppBskyFeedDefs, AppBskyUnspeccedDefs, - type AppBskyUnspeccedGetPostThreadHiddenV2, + type AppBskyUnspeccedGetPostThreadOtherV2, type AppBskyUnspeccedGetPostThreadV2, AtUri, } from '@atproto/api' @@ -62,17 +62,15 @@ export function createCacheMutator({ /* * Additional replies query mutator. */ - queryClient.setQueryData( + queryClient.setQueryData( postThreadOtherQueryKey, data => { if (!data) return - console.log(data) return { ...data, - thread: - mutator([ - ...data.thread, - ]), + thread: mutator([ + ...data.thread, + ]), } }, ) diff --git a/src/state/queries/usePostThread/types.ts b/src/state/queries/usePostThread/types.ts index b24b8421fe..785d7a369c 100644 --- a/src/state/queries/usePostThread/types.ts +++ b/src/state/queries/usePostThread/types.ts @@ -3,14 +3,14 @@ import { type AppBskyFeedPost, type AppBskyFeedThreadgate, type AppBskyUnspeccedDefs, - type AppBskyUnspeccedGetPostThreadHiddenV2, + type AppBskyUnspeccedGetPostThreadOtherV2, type AppBskyUnspeccedGetPostThreadV2, type ModerationDecision, } from '@atproto/api' export type ApiThreadItem = | AppBskyUnspeccedGetPostThreadV2.ThreadItem - | AppBskyUnspeccedGetPostThreadHiddenV2.ThreadHiddenItem + | AppBskyUnspeccedGetPostThreadOtherV2.ThreadItem export const postThreadQueryKeyRoot = 'post-thread-v2' as const @@ -18,7 +18,7 @@ export const createPostThreadQueryKey = (props: PostThreadParams) => [postThreadQueryKeyRoot, props] as const export const createPostThreadOtherQueryKey = ( - props: Omit & { + props: Omit & { anchor?: string }, ) => [postThreadQueryKeyRoot, 'other', props] as const @@ -32,7 +32,7 @@ export type PostThreadParams = Pick< } export type UsePostThreadQueryResult = { - hasHiddenReplies: boolean + hasOtherReplies: boolean thread: AppBskyUnspeccedGetPostThreadV2.ThreadItem[] threadgate?: Omit & { record: AppBskyFeedThreadgate.Record diff --git a/yarn.lock b/yarn.lock index 7c5354c0aa..0d6f907bd4 100644 --- a/yarn.lock +++ b/yarn.lock @@ -63,10 +63,10 @@ "@atproto/xrpc" "^0.7.0" "@atproto/xrpc-server" "^0.7.18" -"@atproto/api@^0.15.12": - version "0.15.12" - resolved "https://registry.yarnpkg.com/@atproto/api/-/api-0.15.12.tgz#0b86eef80b052194353926327acf85c6299b9c04" - integrity sha512-51IHenZMA+Ekfe2OlZL/mTFqvZQU93jI4xsLvTFhGc4tSQYCHV9r/AJTANPZLFrhm9GfWZ0n90r/9IQl9eicjg== +"@atproto/api@^0.15.13": + version "0.15.13" + resolved "https://registry.yarnpkg.com/@atproto/api/-/api-0.15.13.tgz#3d8f22f643da5b1039fd98d53a327d992b01b71f" + integrity sha512-V5ADCdZAcv+XcVqv/8+NPoFPPOXR7KkK9WecjZ03297QH6GzrGYDG7R1zjfWf82qfZtHNELflszvKHLAoI+HZg== dependencies: "@atproto/common-web" "^0.4.2" "@atproto/lexicon" "^0.4.11"