persist startup queries

This commit is contained in:
Samuel Newman
2025-12-26 13:58:32 +00:00
parent bfd5ed480f
commit c8cdf18bd4
7 changed files with 47 additions and 8 deletions
+6
View File
@@ -35,6 +35,12 @@ cfg.resolver.resolveRequest = (context, moduleName, platform) => {
if (moduleName === '@ipld/dag-cbor') {
return context.resolveRequest(context, '@ipld/dag-cbor/src', platform)
}
if (moduleName === 'copy-anything') {
return context.resolveRequest(context, 'copy-anything/dist', platform)
}
if (moduleName === 'is-what') {
return context.resolveRequest(context, 'is-what/dist', platform)
}
if (process.env.BSKY_PROFILE) {
if (moduleName.endsWith('ReactNativeRenderer-prod')) {
return context.resolveRequest(
+1
View File
@@ -222,6 +222,7 @@
"react-textarea-autosize": "^8.5.3",
"sonner": "^2.0.7",
"sonner-native": "^0.21.0",
"superjson": "^2.2.6",
"tippy.js": "^6.3.7",
"tlds": "^1.234.0",
"tldts": "^6.1.46",
+2 -1
View File
@@ -146,7 +146,8 @@ export function Splash(props: React.PropsWithChildren<Props>) {
withTiming(
1,
{duration: 400, easing: Easing.out(Easing.cubic)},
async () => {
() => {
'worklet'
// set these values to check animation at specific point
outroLogo.set(() =>
withTiming(
+17 -4
View File
@@ -7,7 +7,7 @@ import {
PersistQueryClientProvider,
type PersistQueryClientProviderProps,
} from '@tanstack/react-query-persist-client'
import type React from 'react'
import {SuperJSON} from 'superjson'
import {listenNetworkConfirmed, listenNetworkLost} from '#/state/events'
import {IS_NATIVE, IS_WEB} from '#/env'
@@ -18,9 +18,17 @@ declare global {
}
}
// any query keys in this array will be persisted to AsyncStorage
// any query keys in this array will be persisted to AsyncStorage.
// keys are here for require cycle reasons ¯\_(ツ)_/¯
export const labelersDetailedInfoQueryKeyRoot = 'labelers-detailed-info'
const STORED_CACHE_QUERY_KEY_ROOTS = [labelersDetailedInfoQueryKeyRoot]
export const preferencesQueryKeyRoot = 'get-preferences'
export const pinnedFeedInfosQueryKeyRoot = 'pinned-feeds-infos'
const STORED_CACHE_QUERY_KEY_ROOTS = [
labelersDetailedInfoQueryKeyRoot,
preferencesQueryKeyRoot,
pinnedFeedInfosQueryKeyRoot,
]
async function checkIsOnline(): Promise<boolean> {
try {
@@ -160,6 +168,8 @@ export function QueryProvider({
)
}
const PERSIST_VERSION = 2
function QueryProviderInner({
children,
currentDid,
@@ -179,7 +189,10 @@ function QueryProviderInner({
const [persistOptions, _setPersistOptions] = useState(() => {
const asyncPersister = createAsyncStoragePersister({
storage: AsyncStorage,
key: 'queryClient-' + (currentDid ?? 'logged-out'),
key:
'queryClient-' + (currentDid ?? 'logged-out') + `-v${PERSIST_VERSION}`,
serialize: SuperJSON.stringify,
deserialize: SuperJSON.parse,
})
return {
persister: asyncPersister,
+1 -2
View File
@@ -20,6 +20,7 @@ import {
} from '@tanstack/react-query'
import {DISCOVER_FEED_URI, DISCOVER_SAVED_FEED} from '#/lib/constants'
import {pinnedFeedInfosQueryKeyRoot} from '#/lib/react-query'
import {sanitizeDisplayName} from '#/lib/strings/display-names'
import {sanitizeHandle} from '#/lib/strings/handles'
import {STALE} from '#/state/queries'
@@ -418,8 +419,6 @@ const PWI_DISCOVER_FEED_STUB: SavedFeedSourceInfo = {
contentMode: undefined,
}
const pinnedFeedInfosQueryKeyRoot = 'pinnedFeedsInfos'
export function usePinnedFeedsInfos() {
const {hasSession} = useSession()
const agent = useAgent()
+1 -1
View File
@@ -8,6 +8,7 @@ import {useMutation, useQuery, useQueryClient} from '@tanstack/react-query'
import {PROD_DEFAULT_FEED} from '#/lib/constants'
import {replaceEqualDeep} from '#/lib/functions'
import {preferencesQueryKeyRoot} from '#/lib/react-query'
import {getAge} from '#/lib/strings/time'
import {STALE} from '#/state/queries'
import {
@@ -29,7 +30,6 @@ export * from '#/state/queries/preferences/const'
export * from '#/state/queries/preferences/moderation'
export * from '#/state/queries/preferences/types'
const preferencesQueryKeyRoot = 'getPreferences'
export const preferencesQueryKey = [preferencesQueryKeyRoot]
export function usePreferencesQuery() {
+19
View File
@@ -9722,6 +9722,13 @@ cookie@^0.7.0:
resolved "https://registry.yarnpkg.com/cookie/-/cookie-0.7.2.tgz#556369c472a2ba910f2979891b526b3436237ed7"
integrity sha512-yki5XnKuf750l50uGTllt6kKILY4nQ1eNIQatoXEByZ5dWgnKqbnqmTrBE5B4N7lrMJKQ2ytWMiTO2o0v6Ew/w==
copy-anything@^4:
version "4.0.5"
resolved "https://registry.yarnpkg.com/copy-anything/-/copy-anything-4.0.5.tgz#16cabafd1ea4bb327a540b750f2b4df522825aea"
integrity sha512-7Vv6asjS4gMOuILabD3l739tsaxFQmC+a7pLZm02zyvs8p977bL3zEgq3yDk5rn9B0PbYgIv++jmHcuUab4RhA==
dependencies:
is-what "^5.2.0"
copy-webpack-plugin@^10.2.0:
version "10.2.4"
resolved "https://registry.yarnpkg.com/copy-webpack-plugin/-/copy-webpack-plugin-10.2.4.tgz#6c854be3fdaae22025da34b9112ccf81c63308fe"
@@ -13525,6 +13532,11 @@ is-weakset@^2.0.3:
call-bound "^1.0.3"
get-intrinsic "^1.2.6"
is-what@^5.2.0:
version "5.5.0"
resolved "https://registry.yarnpkg.com/is-what/-/is-what-5.5.0.tgz#a3031815757cfe1f03fed990bf6355a2d3f628c4"
integrity sha512-oG7cgbmg5kLYae2N5IVd3jm2s+vldjxJzK1pcu9LfpGuQ93MQSzo0okvRna+7y5ifrD+20FE8FvjusyGaz14fw==
is-wsl@^2.0.0, is-wsl@^2.1.1, is-wsl@^2.2.0:
version "2.2.0"
resolved "https://registry.yarnpkg.com/is-wsl/-/is-wsl-2.2.0.tgz#74a4c76e77ca9fd3f932f290c17ea326cd157271"
@@ -18913,6 +18925,13 @@ sucrase@~3.35.1:
tinyglobby "^0.2.11"
ts-interface-checker "^0.1.9"
superjson@^2.2.6:
version "2.2.6"
resolved "https://registry.yarnpkg.com/superjson/-/superjson-2.2.6.tgz#a223a3a988172a5f9656e2063fe5f733af40d099"
integrity sha512-H+ue8Zo4vJmV2nRjpx86P35lzwDT3nItnIsocgumgr0hHMQ+ZGq5vrERg9kJBo5AWGmxZDhzDo+WVIJqkB0cGA==
dependencies:
copy-anything "^4"
supports-color@^5.3.0:
version "5.5.0"
resolved "https://registry.yarnpkg.com/supports-color/-/supports-color-5.5.0.tgz#e2e69a44ac8772f78a1ec0b35b689df6530efc8f"