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"
},
"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",
+8 -8
View File
@@ -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,
}),
@@ -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<AppBskyUnspeccedGetPostThreadHiddenV2.OutputSchema>(
queryClient.setQueryData<AppBskyUnspeccedGetPostThreadOtherV2.OutputSchema>(
postThreadOtherQueryKey,
data => {
if (!data) return
console.log(data)
return {
...data,
thread:
mutator<AppBskyUnspeccedGetPostThreadHiddenV2.ThreadHiddenItem>([
...data.thread,
]),
thread: mutator<AppBskyUnspeccedGetPostThreadOtherV2.ThreadItem>([
...data.thread,
]),
}
},
)
+4 -4
View File
@@ -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<AppBskyUnspeccedGetPostThreadHiddenV2.QueryParams, 'anchor'> & {
props: Omit<AppBskyUnspeccedGetPostThreadOtherV2.QueryParams, 'anchor'> & {
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<AppBskyFeedDefs.ThreadgateView, 'record'> & {
record: AppBskyFeedThreadgate.Record
+4 -4
View File
@@ -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"