diff --git a/src/analytics/index.tsx b/src/analytics/index.tsx index c32b81384..82f546036 100644 --- a/src/analytics/index.tsx +++ b/src/analytics/index.tsx @@ -24,7 +24,6 @@ import { import {type Metrics, metrics} from '#/analytics/metrics' import * as refParams from '#/analytics/misc/refParams' import * as env from '#/env' -import {device} from '#/storage' export * as utils from '#/analytics/utils' export const features = {init, refresh} diff --git a/src/lib/media/manip.ts b/src/lib/media/manip.ts index 1019d5e99..e3f95c41d 100644 --- a/src/lib/media/manip.ts +++ b/src/lib/media/manip.ts @@ -21,7 +21,6 @@ import {logger} from '#/logger' import {IS_ANDROID, IS_IOS} from '#/env' import {type PickerImage} from './picker.shared' import {type Dimensions} from './types' -import {mimeToExt} from './video/util' export async function compressIfNeeded( img: PickerImage, diff --git a/src/screens/Login/index.tsx b/src/screens/Login/index.tsx index 70f563ed4..82a2316b5 100644 --- a/src/screens/Login/index.tsx +++ b/src/screens/Login/index.tsx @@ -38,7 +38,6 @@ const OrderedForms = [ export const Login = ({onPressBack}: {onPressBack: () => void}) => { const {_} = useLingui() const failedAttemptCountRef = useRef(0) - const startTimeRef = useRef(Date.now()) const {accounts} = useSession() const {requestedAccountSwitchTo} = useLoggedOutView() @@ -65,11 +64,8 @@ export const Login = ({onPressBack}: {onPressBack: () => void}) => { >('Forward') const ax = useAnalytics() - const { - data: serviceDescription, - error: serviceError, - refetch: refetchService, - } = useServiceQuery(serviceUrl) + const {data: serviceDescription, error: serviceError} = + useServiceQuery(serviceUrl) const onSelectAccount = (account?: SessionAccount) => { if (account?.service) { @@ -103,11 +99,6 @@ export const Login = ({onPressBack}: {onPressBack: () => void}) => { } }, [serviceError, serviceUrl, _]) - const onPressForgotPassword = () => { - gotoForm(Forms.ForgotPassword) - ax.metric('signin:forgotPasswordPressed', {}) - } - const handlePressBack = () => { onPressBack() setScreenTransitionDirection('Backward') @@ -116,18 +107,6 @@ export const Login = ({onPressBack}: {onPressBack: () => void}) => { }) } - const onAttemptSuccess = () => { - ax.metric('signin:success', { - isUsingCustomProvider: serviceUrl !== DEFAULT_SERVICE, - timeTakenSeconds: Math.round((Date.now() - startTimeRef.current) / 1000), - failedAttemptsCount: failedAttemptCountRef.current, - }) - } - - const onAttemptFailed = () => { - failedAttemptCountRef.current += 1 - } - let content = null let title = '' let description = '' diff --git a/src/screens/Settings/AppIconSettings/index.tsx b/src/screens/Settings/AppIconSettings/index.tsx index 383cf5f01..a99b98b52 100644 --- a/src/screens/Settings/AppIconSettings/index.tsx +++ b/src/screens/Settings/AppIconSettings/index.tsx @@ -14,11 +14,10 @@ import {atoms as a, useTheme} from '#/alf' import * as Toggle from '#/components/forms/Toggle' import * as Layout from '#/components/Layout' import {Text} from '#/components/Typography' -import {IS_ANDROID, IS_INTERNAL} from '#/env' +import {IS_ANDROID} from '#/env' type Props = NativeStackScreenProps export function AppIconSettingsScreen({}: Props) { - const t = useTheme() const {_} = useLingui() const sets = useAppIconSets() const [currentAppIcon, setCurrentAppIcon] = useState(() => diff --git a/src/screens/Signup/StepInfo/index.tsx b/src/screens/Signup/StepInfo/index.tsx index 2e2ffa0bc..8b2520954 100644 --- a/src/screens/Signup/StepInfo/index.tsx +++ b/src/screens/Signup/StepInfo/index.tsx @@ -6,6 +6,7 @@ import * as EmailValidator from 'email-validator' import type tldts from 'tldts' import {isEmailMaybeInvalid} from '#/lib/strings/email' +import {getAge} from '#/lib/strings/time' import {logger} from '#/logger' import {useSignupContext} from '#/screens/Signup/state' import {Policies} from '#/screens/Signup/StepInfo/Policies' @@ -20,7 +21,6 @@ import {Envelope_Stroke2_Corner0_Rounded as Envelope} from '#/components/icons/E import {Lock_Stroke2_Corner0_Rounded as Lock} from '#/components/icons/Lock' import {Ticket_Stroke2_Corner0_Rounded as Ticket} from '#/components/icons/Ticket' import {Loader} from '#/components/Loader' -import {getAge} from '#/lib/strings/time' import {useAnalytics} from '#/analytics' import {BackNextButtons} from '../BackNextButtons' @@ -304,7 +304,6 @@ export function StepInfo({ ) : undefined} - ) : undefined} diff --git a/src/state/queries/handle.ts b/src/state/queries/handle.ts index 1f78a1504..e1f91178a 100644 --- a/src/state/queries/handle.ts +++ b/src/state/queries/handle.ts @@ -1,8 +1,11 @@ import React from 'react' -import {fetchQueryWithFallback, useMutation, useQueryClient} from './useQueryWithFallback' -import {STALE} from '#/state/queries' import {useAgent} from '#/state/session' +import { + fetchQueryWithFallback, + useMutation, + useQueryClient, +} from './useQueryWithFallback' const handleQueryKeyRoot = 'handle' const fetchHandleQueryKey = (handleOrDid: string) => [ diff --git a/src/state/queries/post.ts b/src/state/queries/post.ts index 1a37dde3b..12975fdb3 100644 --- a/src/state/queries/post.ts +++ b/src/state/queries/post.ts @@ -1,6 +1,5 @@ import {useCallback} from 'react' import {type AppBskyActorDefs, type AppBskyFeedDefs, AtUri} from '@atproto/api' -import {fetchQueryWithFallback, useMutation, useQuery, useQueryClient} from './useQueryWithFallback' import {useToggleMutationQueue} from '#/lib/hooks/useToggleMutationQueue' import {updatePostShadow} from '#/state/cache/post-shadow' @@ -11,6 +10,12 @@ 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] -- knotmirror 0.0.1 From c79e03530ffcbd8d36b898d98172f4228eed5cb0 Mon Sep 17 00:00:00 2001 From: Rudy Fraser Date: Thu, 7 May 2026 11:15:45 -0400 Subject: [PATCH 2/4] Fix prettier formatting and broken tests MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Run prettier --write on 11 pre-existing unformatted files (already failing on main) so the Lint workflow's Prettier step passes. Fix 7 string.test.ts failures by updating fork-customized expectations: - toNiceDomain now special-cases blacksky.app → 'Blacksky Algorithms' - toShareUrl rewrites relative paths under blacksky.community - youtube embed playerUri uses blacksky.community as iframe host - starter pack utm_source is 'blacksky' (not 'bluesky') - Google Play package id is community.blacksky.app Remove dead jest.mock() calls in session-test.ts for '../../birthdate' and '../../../ageAssurance/data'; both modules were deleted in 013d06ccf ('Remove age assurance, geolocation, policy overlays, and NUX dialogs') and the reducer/agent under test no longer transitively imports them. --- __tests__/lib/string.test.ts | 58 ++++++--- src/analytics/features/index.ts | 10 +- src/components/Link.tsx | 12 +- src/components/RichTextTag.tsx | 2 +- src/screens/Moderation/index.tsx | 122 +++++++++--------- src/screens/Profile/Header/Handle.tsx | 9 +- .../Settings/FollowingFeedPreferences.tsx | 2 +- .../Signup/StepCaptcha/CaptchaWebView.tsx | 4 +- src/screens/Signup/StepHandle/index.tsx | 6 +- src/screens/Topic.tsx | 8 +- src/state/session/__tests__/session-test.ts | 2 - src/state/shell/composer/index.tsx | 6 +- .../createNativeStackNavigatorWithAuth.tsx | 1 - 13 files changed, 128 insertions(+), 114 deletions(-) diff --git a/__tests__/lib/string.test.ts b/__tests__/lib/string.test.ts index c59c8b3e3..563e6cf05 100644 --- a/__tests__/lib/string.test.ts +++ b/__tests__/lib/string.test.ts @@ -228,11 +228,16 @@ describe('cleanError', () => { describe('toNiceDomain', () => { const inputs = [ 'https://example.com/index.html', - 'https://bsky.app', + 'https://blacksky.app', 'https://bsky.social', '#123123123', ] - const outputs = ['example.com', 'bsky.app', 'Bluesky Social', '#123123123'] + const outputs = [ + 'example.com', + 'Blacksky Algorithms', + 'bsky.social', + '#123123123', + ] it("displays the url's host in a easily readable manner", () => { for (let i = 0; i < inputs.length; i++) { @@ -270,8 +275,8 @@ describe('toShareUrl', () => { const inputs = ['https://bsky.app', '/3jk7x4irgv52r', 'item/test/123'] const outputs = [ 'https://bsky.app', - 'https://bsky.app/3jk7x4irgv52r', - 'https://bsky.app/item/test/123', + 'https://blacksky.community/3jk7x4irgv52r', + 'https://blacksky.community/item/test/123', ] it('appends https, when not present', () => { @@ -443,58 +448,69 @@ describe('parseEmbedPlayerFromUrl', () => { { type: 'youtube_video', source: 'youtube', - playerUri: 'https://bsky.app/iframe/youtube.html?videoId=videoId&start=0', + playerUri: + 'https://blacksky.community/iframe/youtube.html?videoId=videoId&start=0', }, { type: 'youtube_video', source: 'youtube', - playerUri: 'https://bsky.app/iframe/youtube.html?videoId=videoId&start=1', + playerUri: + 'https://blacksky.community/iframe/youtube.html?videoId=videoId&start=1', }, { type: 'youtube_video', source: 'youtube', - playerUri: 'https://bsky.app/iframe/youtube.html?videoId=videoId&start=0', + playerUri: + 'https://blacksky.community/iframe/youtube.html?videoId=videoId&start=0', }, { type: 'youtube_video', source: 'youtube', - playerUri: 'https://bsky.app/iframe/youtube.html?videoId=videoId&start=0', + playerUri: + 'https://blacksky.community/iframe/youtube.html?videoId=videoId&start=0', }, { type: 'youtube_video', source: 'youtube', - playerUri: 'https://bsky.app/iframe/youtube.html?videoId=videoId&start=1', + playerUri: + 'https://blacksky.community/iframe/youtube.html?videoId=videoId&start=1', }, { type: 'youtube_video', source: 'youtube', - playerUri: 'https://bsky.app/iframe/youtube.html?videoId=videoId&start=0', + playerUri: + 'https://blacksky.community/iframe/youtube.html?videoId=videoId&start=0', }, { type: 'youtube_video', source: 'youtube', - playerUri: 'https://bsky.app/iframe/youtube.html?videoId=videoId&start=0', + playerUri: + 'https://blacksky.community/iframe/youtube.html?videoId=videoId&start=0', }, { type: 'youtube_short', source: 'youtubeShorts', hideDetails: true, - playerUri: 'https://bsky.app/iframe/youtube.html?videoId=videoId&start=0', + playerUri: + 'https://blacksky.community/iframe/youtube.html?videoId=videoId&start=0', }, { type: 'youtube_video', source: 'youtube', - playerUri: 'https://bsky.app/iframe/youtube.html?videoId=videoId&start=0', + playerUri: + 'https://blacksky.community/iframe/youtube.html?videoId=videoId&start=0', }, { type: 'youtube_video', source: 'youtube', - playerUri: 'https://bsky.app/iframe/youtube.html?videoId=videoId&start=0', + playerUri: + 'https://blacksky.community/iframe/youtube.html?videoId=videoId&start=0', }, { type: 'youtube_video', source: 'youtube', - playerUri: 'https://bsky.app/iframe/youtube.html?videoId=videoId&start=0', + playerUri: + 'https://blacksky.community/iframe/youtube.html?videoId=videoId&start=0', }, undefined, @@ -835,13 +851,13 @@ describe('createStarterPackLinkFromAndroidReferrer', () => { it('returns a link when input contains utm_source and utm_content', () => { expect( createStarterPackLinkFromAndroidReferrer( - 'utm_source=bluesky&utm_content=starterpack_haileyok.com_rkey', + 'utm_source=blacksky&utm_content=starterpack_haileyok.com_rkey', ), ).toEqual(validOutput) expect( createStarterPackLinkFromAndroidReferrer( - 'utm_source=bluesky&utm_content=starterpack_test-lover-9000.com_rkey', + 'utm_source=blacksky&utm_content=starterpack_test-lover-9000.com_rkey', ), ).toEqual('at://test-lover-9000.com/app.bsky.graph.starterpack/rkey') }) @@ -849,7 +865,7 @@ describe('createStarterPackLinkFromAndroidReferrer', () => { it('returns a link when input contains utm_source and utm_content in different order', () => { expect( createStarterPackLinkFromAndroidReferrer( - 'utm_content=starterpack_haileyok.com_rkey&utm_source=bluesky', + 'utm_content=starterpack_haileyok.com_rkey&utm_source=blacksky', ), ).toEqual(validOutput) }) @@ -857,7 +873,7 @@ describe('createStarterPackLinkFromAndroidReferrer', () => { it('returns a link when input contains other parameters as well', () => { expect( createStarterPackLinkFromAndroidReferrer( - 'utm_source=bluesky&utm_medium=starterpack&utm_content=starterpack_haileyok.com_rkey', + 'utm_source=blacksky&utm_medium=starterpack&utm_content=starterpack_haileyok.com_rkey', ), ).toEqual(validOutput) }) @@ -872,7 +888,7 @@ describe('createStarterPackLinkFromAndroidReferrer', () => { it('returns null when utm_content is not present', () => { expect( - createStarterPackLinkFromAndroidReferrer('utm_source=bluesky'), + createStarterPackLinkFromAndroidReferrer('utm_source=blacksky'), ).toEqual(null) }) @@ -981,7 +997,7 @@ describe('parseStarterPackHttpUri', () => { describe('createStarterPackGooglePlayUri', () => { const base = - 'https://play.google.com/store/apps/details?id=xyz.blueskyweb.app&referrer=utm_source%3Dbluesky%26utm_medium%3Dstarterpack%26utm_content%3Dstarterpack_' + 'https://play.google.com/store/apps/details?id=community.blacksky.app&referrer=utm_source%3Dblacksky%26utm_medium%3Dstarterpack%26utm_content%3Dstarterpack_' it('returns valid google play uri when input is valid', () => { expect(createStarterPackGooglePlayUri('name', 'rkey')).toEqual( diff --git a/src/analytics/features/index.ts b/src/analytics/features/index.ts index 2d5eaee4c..427755f7e 100644 --- a/src/analytics/features/index.ts +++ b/src/analytics/features/index.ts @@ -43,10 +43,12 @@ export const features = new GrowthBook({ * that case, we may see a flash of uncustomized content until the * initialization completes. */ -export const init = features.init({timeout: TIMEOUT_INIT, streaming: true}).catch(() => { - // Swallow errors from GrowthBook init (e.g. CORS failures, cache - // corruption). The app should still load without feature gates. -}) +export const init = features + .init({timeout: TIMEOUT_INIT, streaming: true}) + .catch(() => { + // Swallow errors from GrowthBook init (e.g. CORS failures, cache + // corruption). The app should still load without feature gates. + }) /** * Refresh feature gates from GrowthBook. Updates attributes based on the diff --git a/src/components/Link.tsx b/src/components/Link.tsx index 31e9feb82..8a22f499d 100644 --- a/src/components/Link.tsx +++ b/src/components/Link.tsx @@ -125,9 +125,9 @@ export function useLink({ const requiresWarning = Boolean( !disableMismatchWarning && - displayText && - isExternal && - linkRequiresWarning(href, displayText), + displayText && + isExternal && + linkRequiresWarning(href, displayText), ) if (IS_WEB) { @@ -220,9 +220,9 @@ export function useLink({ const handleLongPress = React.useCallback(() => { const requiresWarning = Boolean( !disableMismatchWarning && - displayText && - isExternal && - linkRequiresWarning(href, displayText), + displayText && + isExternal && + linkRequiresWarning(href, displayText), ) if (requiresWarning) { diff --git a/src/components/RichTextTag.tsx b/src/components/RichTextTag.tsx index fe06252b2..b617cdb0e 100644 --- a/src/components/RichTextTag.tsx +++ b/src/components/RichTextTag.tsx @@ -61,7 +61,7 @@ export function RichTextTag({ optimisticUpsert?.find( m => m.value === tag && m.targets.includes('tag'), )) && - !optimisticRemove?.find(m => m?.value === tag), + !optimisticRemove?.find(m => m?.value === tag), ) /* diff --git a/src/screens/Moderation/index.tsx b/src/screens/Moderation/index.tsx index 53f1219f7..c2aac7ff6 100644 --- a/src/screens/Moderation/index.tsx +++ b/src/screens/Moderation/index.tsx @@ -321,70 +321,70 @@ export function ModerationScreenInner({ t.atoms.bg_contrast_25, ]}> - - Enable adult content + style={[ + a.py_lg, + a.px_lg, + a.flex_row, + a.align_center, + a.justify_between, + adultContentUIDisabled && {opacity: 0.5}, + ]}> + + Enable adult content + + + + + {adultContentEnabled ? ( + Enabled + ) : ( + Disabled + )} - - - - {adultContentEnabled ? ( - Enabled - ) : ( - Disabled - )} - - - - + - {adultContentUIDisabledOnIOS && ( - - - - Adult content can only be enabled via the Web at{' '} - { - evt.preventDefault() - Linking.openURL('https://bsky.app/') - return false - }}> - bsky.app - - . - - - - )} + + + {adultContentUIDisabledOnIOS && ( + + + + Adult content can only be enabled via the Web at{' '} + { + evt.preventDefault() + Linking.openURL('https://bsky.app/') + return false + }}> + bsky.app + + . + + + + )} - {adultContentEnabled && ( - <> - - - - - - - - - - )} + {adultContentEnabled && ( + <> + + + + + + + + + + )} diff --git a/src/screens/Profile/Header/Handle.tsx b/src/screens/Profile/Header/Handle.tsx index 606e0a9ec..2ebf498af 100644 --- a/src/screens/Profile/Header/Handle.tsx +++ b/src/screens/Profile/Header/Handle.tsx @@ -66,13 +66,8 @@ export function ProfileHeaderHandle({ )} {sanitizePronouns(pronouns ?? '', IS_NATIVE) && ( - -{sanitizePronouns(pronouns ?? '', IS_NATIVE)} + + {sanitizePronouns(pronouns ?? '', IS_NATIVE)} )} diff --git a/src/screens/Settings/FollowingFeedPreferences.tsx b/src/screens/Settings/FollowingFeedPreferences.tsx index 7f1ae1d32..658456e0e 100644 --- a/src/screens/Settings/FollowingFeedPreferences.tsx +++ b/src/screens/Settings/FollowingFeedPreferences.tsx @@ -44,7 +44,7 @@ export function FollowingFeedPreferencesScreen({}: Props) { const mergeFeedEnabled = Boolean( variables?.lab_mergeFeedEnabled ?? - preferences?.feedViewPrefs?.lab_mergeFeedEnabled, + preferences?.feedViewPrefs?.lab_mergeFeedEnabled, ) return ( diff --git a/src/screens/Signup/StepCaptcha/CaptchaWebView.tsx b/src/screens/Signup/StepCaptcha/CaptchaWebView.tsx index e2dfd2cd0..58cc745d6 100644 --- a/src/screens/Signup/StepCaptcha/CaptchaWebView.tsx +++ b/src/screens/Signup/StepCaptcha/CaptchaWebView.tsx @@ -45,11 +45,11 @@ export function CaptchaWebView({ }, []) const redirectHost = useMemo(() => { - if (!state?.serviceUrl) return 'blacksky.community' + if (!state?.serviceUrl) return 'blacksky.community' return state?.serviceUrl && new URL(state?.serviceUrl).host === 'staging.bsky.dev' - ? 'app.staging.bsky.dev' + ? 'app.staging.bsky.dev' : 'blacksky.community' }, [state?.serviceUrl]) diff --git a/src/screens/Signup/StepHandle/index.tsx b/src/screens/Signup/StepHandle/index.tsx index 23367b22f..021b825a1 100644 --- a/src/screens/Signup/StepHandle/index.tsx +++ b/src/screens/Signup/StepHandle/index.tsx @@ -162,8 +162,7 @@ export function StepHandle() { value: selectedDomain, }) dispatch({type: 'prev'}) - ax.metric('signup:backPressed', {activeStep: state.activeStep} - ) + ax.metric('signup:backPressed', {activeStep: state.activeStep}) } return ( @@ -287,8 +286,7 @@ export function StepHandle() { {isHandleAvailable?.suggestions && - isHandleAvailable.suggestions.length > 0 && - ( + isHandleAvailable.suggestions.length > 0 && ( { diff --git a/src/screens/Topic.tsx b/src/screens/Topic.tsx index 9a0870dbf..1b673892b 100644 --- a/src/screens/Topic.tsx +++ b/src/screens/Topic.tsx @@ -102,7 +102,13 @@ export default function TopicScreen({ } // Legacy: search-based topic view (non-numeric topic param) - return + return ( + + ) } function CuratedTopicFeed({ diff --git a/src/state/session/__tests__/session-test.ts b/src/state/session/__tests__/session-test.ts index 60d897e15..cb35dd4d6 100644 --- a/src/state/session/__tests__/session-test.ts +++ b/src/state/session/__tests__/session-test.ts @@ -10,8 +10,6 @@ jest.mock('jwt-decode', () => ({ }, })) -jest.mock('../../birthdate') -jest.mock('../../../ageAssurance/data') jest.mock('#/lib/notifications/notifications', () => ({ unregisterPushToken(_agents: BskyAgent[]) { return Promise.resolve() diff --git a/src/state/shell/composer/index.tsx b/src/state/shell/composer/index.tsx index 263ab845a..591f39e3c 100644 --- a/src/state/shell/composer/index.tsx +++ b/src/state/shell/composer/index.tsx @@ -95,9 +95,9 @@ export function Provider({children}: React.PropsWithChildren<{}>) { const author = opts.replyTo?.author || opts.quote?.author const isBlocked = Boolean( author && - (author.viewer?.blocking || - author.viewer?.blockedBy || - author.viewer?.blockingByList), + (author.viewer?.blocking || + author.viewer?.blockedBy || + author.viewer?.blockingByList), ) if (isBlocked) { Toast.show( diff --git a/src/view/shell/createNativeStackNavigatorWithAuth.tsx b/src/view/shell/createNativeStackNavigatorWithAuth.tsx index ce5bbc747..ffe66d217 100644 --- a/src/view/shell/createNativeStackNavigatorWithAuth.tsx +++ b/src/view/shell/createNativeStackNavigatorWithAuth.tsx @@ -162,7 +162,6 @@ function NativeStackNavigator({ {!isMobile && } )} - ) } -- knotmirror 0.0.1 From 9f9d448829971c4aa5c5dba2c2f56f3b7a4da546 Mon Sep 17 00:00:00 2001 From: Rudy Fraser Date: Thu, 7 May 2026 11:32:37 -0400 Subject: [PATCH 3/4] Fix typecheck errors MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - AssemblyEmbed.tsx: a.font_semibold → a.font_semi_bold (4 occurrences) - feed.ts: import missing QueryKey type - react-query.tsx: type the dehydrate callback's query param explicitly, and reference QueryClient through @tanstack/react-query so the global declaration matches the QueryClient instance we create (the dependency tree has both @tanstack/query-core 5.25.0 and 5.90.20, so importing from query-core directly resolves to the wrong copy) - url-helpers.ts: psl 1.15 publishes types via top-level 'types' but blocks them with package.json 'exports'; map the path to the d.ts file, switch to namespace import (no default in the .d.ts), and narrow the parse() result with 'error' in hostnamep --- .../Embed/ExternalEmbed/AssemblyEmbed.tsx | 8 +++--- src/lib/react-query.tsx | 26 ++++++++++++------- src/lib/strings/url-helpers.ts | 4 +-- src/state/queries/feed.ts | 1 + tsconfig.json | 3 ++- 5 files changed, 25 insertions(+), 17 deletions(-) diff --git a/src/components/Post/Embed/ExternalEmbed/AssemblyEmbed.tsx b/src/components/Post/Embed/ExternalEmbed/AssemblyEmbed.tsx index 6157ab91e..10692249d 100644 --- a/src/components/Post/Embed/ExternalEmbed/AssemblyEmbed.tsx +++ b/src/components/Post/Embed/ExternalEmbed/AssemblyEmbed.tsx @@ -325,7 +325,7 @@ export function AssemblyEmbed({ accessibilityRole="link" accessibilityLabel="Sign in to vote" accessibilityHint="Opens the assembly page to sign in and vote"> - + Sign in to vote @@ -459,7 +459,7 @@ export function AssemblyEmbed({ accessibilityRole="button" accessibilityLabel="Agree" accessibilityHint="Vote agree on this statement"> - + {voting ? '...' : 'Agree'} @@ -478,7 +478,7 @@ export function AssemblyEmbed({ accessibilityRole="button" accessibilityLabel="Disagree" accessibilityHint="Vote disagree on this statement"> - + {voting ? '...' : 'Disagree'} @@ -500,7 +500,7 @@ export function AssemblyEmbed({ {voting ? '...' : 'Pass / Unsure'} diff --git a/src/lib/react-query.tsx b/src/lib/react-query.tsx index ec657b6c4..b18d80592 100644 --- a/src/lib/react-query.tsx +++ b/src/lib/react-query.tsx @@ -1,7 +1,12 @@ import {useEffect, useRef, useState} from 'react' import {AppState, type AppStateStatus} from 'react-native' import {createAsyncStoragePersister} from '@tanstack/query-async-storage-persister' -import {focusManager, onlineManager, QueryClient} from '@tanstack/react-query' +import { + focusManager, + onlineManager, + type Query, + QueryClient, +} from '@tanstack/react-query' import { type PersistQueryClientOptions, PersistQueryClientProvider, @@ -17,7 +22,7 @@ import {IS_NATIVE, IS_WEB} from '#/env' declare global { interface Window { // eslint-disable-next-line @typescript-eslint/consistent-type-imports - __TANSTACK_QUERY_CLIENT__: import('@tanstack/query-core').QueryClient + __TANSTACK_QUERY_CLIENT__: import('@tanstack/react-query').QueryClient } } @@ -133,14 +138,15 @@ const createQueryClient = () => }, }) -const dehydrateOptions: PersistQueryClientProviderProps['persistOptions']['dehydrateOptions'] = - { - shouldDehydrateMutation: (_: any) => false, - shouldDehydrateQuery: query => { - const root = String(query.queryKey[0]) - return root === PERSISTED_QUERY_ROOT - }, - } +const dehydrateOptions: NonNullable< + PersistQueryClientProviderProps['persistOptions']['dehydrateOptions'] +> = { + shouldDehydrateMutation: (_: any) => false, + shouldDehydrateQuery: (query: Query) => { + const root = String(query.queryKey[0]) + return root === PERSISTED_QUERY_ROOT + }, +} export function QueryProvider({ children, diff --git a/src/lib/strings/url-helpers.ts b/src/lib/strings/url-helpers.ts index b8c2153f9..92163110c 100644 --- a/src/lib/strings/url-helpers.ts +++ b/src/lib/strings/url-helpers.ts @@ -1,5 +1,5 @@ import {AtUri} from '@atproto/api' -import psl from 'psl' +import * as psl from 'psl' import TLDs from 'tlds' import {BSKY_SERVICE} from '#/lib/constants' @@ -327,7 +327,7 @@ export function isPossiblyAUrl(str: string): boolean { export function splitApexDomain(hostname: string): [string, string] { const hostnamep = psl.parse(hostname) - if (hostnamep.error || !hostnamep.listed || !hostnamep.domain) { + if ('error' in hostnamep || !hostnamep.listed || !hostnamep.domain) { return ['', hostname] } return [ diff --git a/src/state/queries/feed.ts b/src/state/queries/feed.ts index c9d095a5a..287b5d746 100644 --- a/src/state/queries/feed.ts +++ b/src/state/queries/feed.ts @@ -14,6 +14,7 @@ import { type InfiniteData, keepPreviousData, type QueryClient, + type QueryKey, useInfiniteQuery, useMutation, useQuery, diff --git a/tsconfig.json b/tsconfig.json index 2f3d9354d..3f826e452 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -9,7 +9,8 @@ "#/*": ["./src/*"], "crypto": ["./src/platform/crypto.ts"], "multiformats/cid": ["node_modules/multiformats/types/src/cid.d.ts"], - "multiformats/hashes/hasher": ["node_modules/multiformats/types/src/hashes/hasher.d.ts"] + "multiformats/hashes/hasher": ["node_modules/multiformats/types/src/hashes/hasher.d.ts"], + "psl": ["node_modules/psl/types/index.d.ts"] }, "plugins": [ { -- knotmirror 0.0.1 From fe39d4b1e9184be159ad18bd69bbd1b798f3a178 Mon Sep 17 00:00:00 2001 From: Rudy Fraser Date: Thu, 7 May 2026 11:42:47 -0400 Subject: [PATCH 4/4] Use psl module declaration shim instead of tsconfig path The path mapping I added pointed jest at the .d.ts file at runtime, which it tried to execute as JavaScript and crashed on 'export'. Drop the tsconfig path, restore the default import, and add a project- local 'declare module psl' shim under src/types/. Type-only, so jest's runtime resolution stays on the real psl.cjs/psl.mjs entry points. --- src/lib/strings/url-helpers.ts | 2 +- src/types/psl.d.ts | 22 ++++++++++++++++++++++ tsconfig.json | 3 +-- 3 files changed, 24 insertions(+), 3 deletions(-) create mode 100644 src/types/psl.d.ts diff --git a/src/lib/strings/url-helpers.ts b/src/lib/strings/url-helpers.ts index 92163110c..a0f24281c 100644 --- a/src/lib/strings/url-helpers.ts +++ b/src/lib/strings/url-helpers.ts @@ -1,5 +1,5 @@ import {AtUri} from '@atproto/api' -import * as psl from 'psl' +import psl from 'psl' import TLDs from 'tlds' import {BSKY_SERVICE} from '#/lib/constants' diff --git a/src/types/psl.d.ts b/src/types/psl.d.ts new file mode 100644 index 000000000..75af9b6a6 --- /dev/null +++ b/src/types/psl.d.ts @@ -0,0 +1,22 @@ +declare module 'psl' { + export type ParsedDomain = { + tld: string | null + sld: string | null + domain: string | null + subdomain: string | null + listed: boolean + } + export type ErrorResult = { + input: string + error: {code: string; message: string} + } + export function parse(domain: string): ParsedDomain | ErrorResult + export function get(domain: string): string | null + export function isValid(domain: string): boolean + const psl: { + parse: typeof parse + get: typeof get + isValid: typeof isValid + } + export default psl +} diff --git a/tsconfig.json b/tsconfig.json index 3f826e452..2f3d9354d 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -9,8 +9,7 @@ "#/*": ["./src/*"], "crypto": ["./src/platform/crypto.ts"], "multiformats/cid": ["node_modules/multiformats/types/src/cid.d.ts"], - "multiformats/hashes/hasher": ["node_modules/multiformats/types/src/hashes/hasher.d.ts"], - "psl": ["node_modules/psl/types/index.d.ts"] + "multiformats/hashes/hasher": ["node_modules/multiformats/types/src/hashes/hasher.d.ts"] }, "plugins": [ {