Precache basic profile from posts for instant future navigations (#2795)
* skeleton for caching
* modify some existing logic
* refactor uri resolution query
* add precache feed posts
* adjustments
* remove prefetch on hover (maybe revert, just example)
* fix
* change arg name to match what we want
* optional infinite stale time
* use `ProfileViewDetailed`
* Revert "remove prefetch on hover (maybe revert, just example)"
This reverts commit 08609deb0d.
* add warning comment back for stale time
* remove comment
* store profile with both the handle and did for query key
* remove extra block from revert
* clarify argument name
* remove QT cache
* structure queries the same (put `enabled` at bottom)
* use both `ProfileViewDetailed` and `ProfileView` for the query return type
* placeholder profile header
* remove logs
* remove a few other things we don't need
* add placeholder
* refactor
* refactor
* we don't need this height adjustment now
* use gray banner while loading
* set background color of image to the loading placeholder color
* reorg imports
* add border to header on loading
* Fix style
* Rm radius
* oops
* Undo edit
* Back out type changes
* Tighten some types and moderate shadow
* Move precaching fns to profile where the cache is
* Rename functions to match what they do now
* Remove anys
---------
Co-authored-by: Dan Abramov <dan.abramov@gmail.com>
This commit is contained in:
@@ -21,7 +21,7 @@ import {MergeFeedAPI} from 'lib/api/feed/merge'
|
||||
import {HomeFeedAPI} from '#/lib/api/feed/home'
|
||||
import {logger} from '#/logger'
|
||||
import {STALE} from '#/state/queries'
|
||||
import {precacheFeedPosts as precacheResolvedUris} from './resolve-uri'
|
||||
import {precacheFeedPostProfiles} from './profile'
|
||||
import {getAgent} from '#/state/session'
|
||||
import {DEFAULT_LOGGED_OUT_PREFERENCES} from '#/state/queries/preferences/const'
|
||||
import {getModerationOpts} from '#/state/queries/preferences/moderation'
|
||||
@@ -138,7 +138,7 @@ export function usePostFeedQuery(
|
||||
}
|
||||
|
||||
const res = await api.fetch({cursor, limit: PAGE_SIZE})
|
||||
precacheResolvedUris(queryClient, res.feed) // precache the handle->did resolution
|
||||
precacheFeedPostProfiles(queryClient, res.feed)
|
||||
|
||||
/*
|
||||
* If this is a public view, we need to check if posts fail moderation.
|
||||
|
||||
Reference in New Issue
Block a user