diff --git a/src/lib/strings/url-helpers.ts b/src/lib/strings/url-helpers.ts index 2fa4118e7..9fbc09521 100644 --- a/src/lib/strings/url-helpers.ts +++ b/src/lib/strings/url-helpers.ts @@ -80,9 +80,9 @@ export function toShortUrl(url: string): string { export function toShareUrl(url: string): string { if (!url.startsWith('https')) { - const urlp = new URL(BSKY_APP_HOST) - urlp.pathname = url - url = urlp.toString() + // Parse as a relative URL so a query string survives; assigning to + // pathname percent-encodes the '?' into the path. + url = new URL(url, BSKY_APP_HOST).toString() } return url } diff --git a/src/state/queries/community-feed.ts b/src/state/queries/community-feed.ts index 633d5c12f..4c9bb0d4c 100644 --- a/src/state/queries/community-feed.ts +++ b/src/state/queries/community-feed.ts @@ -1,6 +1,6 @@ import {useMemo} from 'react' import { - type AppBskyFeedDefs, + AppBskyFeedDefs, type AppBskyFeedPost, AtUri, jsonToLex, @@ -290,6 +290,19 @@ export function* findAllPostsInQueryData( if (quotedPost && didOrHandleUriMatches(atUri, quotedPost)) { yield embedViewRecordToPostView(quotedPost) } + + // Reply-context rows render in slices too; without these, likes on + // a parent/root row never reach the shadow cache. + if (AppBskyFeedDefs.isPostView(item.reply?.parent)) { + if (didOrHandleUriMatches(atUri, item.reply.parent)) { + yield item.reply.parent + } + } + if (AppBskyFeedDefs.isPostView(item.reply?.root)) { + if (didOrHandleUriMatches(atUri, item.reply.root)) { + yield item.reply.root + } + } } } } diff --git a/src/view/screens/PostThread.tsx b/src/view/screens/PostThread.tsx index ab8c659cd..c4ba6b7d3 100644 --- a/src/view/screens/PostThread.tsx +++ b/src/view/screens/PostThread.tsx @@ -8,7 +8,16 @@ import * as Layout from '#/components/Layout' type Props = NativeStackScreenProps export function PostThreadScreen({route}: Props) { - const {name, rkey, collection} = route.params + const {name, rkey: rawRkey, collection: rawCollection} = route.params + // Old share links percent-encoded '?collection=...' into the rkey segment. + let rkey = decodeURIComponent(rawRkey) + let collection = rawCollection + const qIndex = rkey.indexOf('?') + if (qIndex !== -1) { + const qs = new URLSearchParams(rkey.slice(qIndex + 1)) + collection = collection || qs.get('collection') || undefined + rkey = rkey.slice(0, qIndex) + } const uri = makeRecordUri(name, collection || 'app.bsky.feed.post', rkey) return (