Update pkg and endpoint

This commit is contained in:
Eric Bailey
2025-06-06 12:17:29 -05:00
parent f93f40ce75
commit ebe9ed901d
5 changed files with 22 additions and 24 deletions
+1 -1
View File
@@ -69,7 +69,7 @@
"icons:optimize": "svgo -f ./assets/icons" "icons:optimize": "svgo -f ./assets/icons"
}, },
"dependencies": { "dependencies": {
"@atproto/api": "^0.15.12", "@atproto/api": "^0.15.13",
"@bitdrift/react-native": "^0.6.8", "@bitdrift/react-native": "^0.6.8",
"@braintree/sanitize-url": "^6.0.2", "@braintree/sanitize-url": "^6.0.2",
"@discord/bottom-sheet": "bluesky-social/react-native-bottom-sheet", "@discord/bottom-sheet": "bluesky-social/react-native-bottom-sheet",
+8 -8
View File
@@ -72,20 +72,20 @@ export function usePostThread({anchor}: {anchor?: string}) {
* we could fetch once we hit the end. * we could fetch once we hit the end.
*/ */
ctx.meta = ctx.meta || { ctx.meta = ctx.meta || {
hasHiddenReplies: false, hasOtherReplies: false,
} }
/* /*
* If we know we have additional replies, we'll set this to true. * If we know we have additional replies, we'll set this to true.
*/ */
if (data.hasHiddenReplies) { if (data.hasOtherReplies) {
ctx.meta.hasHiddenReplies = true ctx.meta.hasOtherReplies = true
} }
const result = { const result = {
thread: data.thread || [], thread: data.thread || [],
threadgate: data.threadgate, threadgate: data.threadgate,
hasHiddenReplies: !!ctx.meta.hasHiddenReplies, hasOtherReplies: !!ctx.meta.hasOtherReplies,
} }
const record = getThreadgateRecord(result.threadgate) const record = getThreadgateRecord(result.threadgate)
@@ -104,7 +104,7 @@ export function usePostThread({anchor}: {anchor?: string}) {
* skeletons. * skeletons.
*/ */
const thread = placeholder ? [placeholder] : [] const thread = placeholder ? [placeholder] : []
return {thread, threadgate: undefined, hasHiddenReplies: false} return {thread, threadgate: undefined, hasOtherReplies: false}
}, },
select(data) { select(data) {
const record = getThreadgateRecord(data.threadgate) const record = getThreadgateRecord(data.threadgate)
@@ -121,8 +121,8 @@ export function usePostThread({anchor}: {anchor?: string}) {
[query.data?.threadgate], [query.data?.threadgate],
) )
const hasOtherThreadItems = useMemo( const hasOtherThreadItems = useMemo(
() => !!query.data?.hasHiddenReplies, () => !!query.data?.hasOtherReplies,
[query.data?.hasHiddenReplies], [query.data?.hasOtherReplies],
) )
const [otherItemsVisible, setOtherItemsVisible] = useState(false) const [otherItemsVisible, setOtherItemsVisible] = useState(false)
@@ -152,7 +152,7 @@ export function usePostThread({anchor}: {anchor?: string}) {
async queryFn() { async queryFn() {
const {data} = await wait( const {data} = await wait(
400, 400,
agent.app.bsky.unspecced.getPostThreadHiddenV2({ agent.app.bsky.unspecced.getPostThreadOtherV2({
anchor: anchor!, anchor: anchor!,
prioritizeFollowedUsers, prioritizeFollowedUsers,
}), }),
@@ -2,7 +2,7 @@ import {
type $Typed, type $Typed,
type AppBskyFeedDefs, type AppBskyFeedDefs,
AppBskyUnspeccedDefs, AppBskyUnspeccedDefs,
type AppBskyUnspeccedGetPostThreadHiddenV2, type AppBskyUnspeccedGetPostThreadOtherV2,
type AppBskyUnspeccedGetPostThreadV2, type AppBskyUnspeccedGetPostThreadV2,
AtUri, AtUri,
} from '@atproto/api' } from '@atproto/api'
@@ -62,15 +62,13 @@ export function createCacheMutator({
/* /*
* Additional replies query mutator. * Additional replies query mutator.
*/ */
queryClient.setQueryData<AppBskyUnspeccedGetPostThreadHiddenV2.OutputSchema>( queryClient.setQueryData<AppBskyUnspeccedGetPostThreadOtherV2.OutputSchema>(
postThreadOtherQueryKey, postThreadOtherQueryKey,
data => { data => {
if (!data) return if (!data) return
console.log(data)
return { return {
...data, ...data,
thread: thread: mutator<AppBskyUnspeccedGetPostThreadOtherV2.ThreadItem>([
mutator<AppBskyUnspeccedGetPostThreadHiddenV2.ThreadHiddenItem>([
...data.thread, ...data.thread,
]), ]),
} }
+4 -4
View File
@@ -3,14 +3,14 @@ import {
type AppBskyFeedPost, type AppBskyFeedPost,
type AppBskyFeedThreadgate, type AppBskyFeedThreadgate,
type AppBskyUnspeccedDefs, type AppBskyUnspeccedDefs,
type AppBskyUnspeccedGetPostThreadHiddenV2, type AppBskyUnspeccedGetPostThreadOtherV2,
type AppBskyUnspeccedGetPostThreadV2, type AppBskyUnspeccedGetPostThreadV2,
type ModerationDecision, type ModerationDecision,
} from '@atproto/api' } from '@atproto/api'
export type ApiThreadItem = export type ApiThreadItem =
| AppBskyUnspeccedGetPostThreadV2.ThreadItem | AppBskyUnspeccedGetPostThreadV2.ThreadItem
| AppBskyUnspeccedGetPostThreadHiddenV2.ThreadHiddenItem | AppBskyUnspeccedGetPostThreadOtherV2.ThreadItem
export const postThreadQueryKeyRoot = 'post-thread-v2' as const export const postThreadQueryKeyRoot = 'post-thread-v2' as const
@@ -18,7 +18,7 @@ export const createPostThreadQueryKey = (props: PostThreadParams) =>
[postThreadQueryKeyRoot, props] as const [postThreadQueryKeyRoot, props] as const
export const createPostThreadOtherQueryKey = ( export const createPostThreadOtherQueryKey = (
props: Omit<AppBskyUnspeccedGetPostThreadHiddenV2.QueryParams, 'anchor'> & { props: Omit<AppBskyUnspeccedGetPostThreadOtherV2.QueryParams, 'anchor'> & {
anchor?: string anchor?: string
}, },
) => [postThreadQueryKeyRoot, 'other', props] as const ) => [postThreadQueryKeyRoot, 'other', props] as const
@@ -32,7 +32,7 @@ export type PostThreadParams = Pick<
} }
export type UsePostThreadQueryResult = { export type UsePostThreadQueryResult = {
hasHiddenReplies: boolean hasOtherReplies: boolean
thread: AppBskyUnspeccedGetPostThreadV2.ThreadItem[] thread: AppBskyUnspeccedGetPostThreadV2.ThreadItem[]
threadgate?: Omit<AppBskyFeedDefs.ThreadgateView, 'record'> & { threadgate?: Omit<AppBskyFeedDefs.ThreadgateView, 'record'> & {
record: AppBskyFeedThreadgate.Record record: AppBskyFeedThreadgate.Record
+4 -4
View File
@@ -63,10 +63,10 @@
"@atproto/xrpc" "^0.7.0" "@atproto/xrpc" "^0.7.0"
"@atproto/xrpc-server" "^0.7.18" "@atproto/xrpc-server" "^0.7.18"
"@atproto/api@^0.15.12": "@atproto/api@^0.15.13":
version "0.15.12" version "0.15.13"
resolved "https://registry.yarnpkg.com/@atproto/api/-/api-0.15.12.tgz#0b86eef80b052194353926327acf85c6299b9c04" resolved "https://registry.yarnpkg.com/@atproto/api/-/api-0.15.13.tgz#3d8f22f643da5b1039fd98d53a327d992b01b71f"
integrity sha512-51IHenZMA+Ekfe2OlZL/mTFqvZQU93jI4xsLvTFhGc4tSQYCHV9r/AJTANPZLFrhm9GfWZ0n90r/9IQl9eicjg== integrity sha512-V5ADCdZAcv+XcVqv/8+NPoFPPOXR7KkK9WecjZ03297QH6GzrGYDG7R1zjfWf82qfZtHNELflszvKHLAoI+HZg==
dependencies: dependencies:
"@atproto/common-web" "^0.4.2" "@atproto/common-web" "^0.4.2"
"@atproto/lexicon" "^0.4.11" "@atproto/lexicon" "^0.4.11"