Fix prefetching starter pack query (#9595)
* fix prefetching starter pack query * add comment
This commit is contained in:
@@ -1,5 +1,5 @@
|
|||||||
import {
|
import {
|
||||||
type AppBskyFeedDefs,
|
AppBskyFeedDefs,
|
||||||
AppBskyGraphDefs,
|
AppBskyGraphDefs,
|
||||||
type AppBskyGraphGetStarterPack,
|
type AppBskyGraphGetStarterPack,
|
||||||
AppBskyGraphStarterpack,
|
AppBskyGraphStarterpack,
|
||||||
@@ -369,6 +369,18 @@ export async function precacheStarterPack(
|
|||||||
AppBskyGraphDefs.isStarterPackViewBasic(starterPack) &&
|
AppBskyGraphDefs.isStarterPackViewBasic(starterPack) &&
|
||||||
bsky.validate(starterPack.record, AppBskyGraphStarterpack.validateRecord)
|
bsky.validate(starterPack.record, AppBskyGraphStarterpack.validateRecord)
|
||||||
) {
|
) {
|
||||||
|
let feeds: AppBskyFeedDefs.GeneratorView[] | undefined
|
||||||
|
if (starterPack.record.feeds) {
|
||||||
|
feeds = []
|
||||||
|
for (const feed of starterPack.record.feeds) {
|
||||||
|
// note: types are wrong? claims to be `FeedItem`, but we actually
|
||||||
|
// get un$typed `GeneratorView` objects here -sfn
|
||||||
|
if (bsky.validate(feed, AppBskyFeedDefs.validateGeneratorView)) {
|
||||||
|
feeds.push(feed)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
const listView: AppBskyGraphDefs.ListViewBasic = {
|
const listView: AppBskyGraphDefs.ListViewBasic = {
|
||||||
uri: starterPack.record.list,
|
uri: starterPack.record.list,
|
||||||
// This will be populated once the data from server is fetched
|
// This will be populated once the data from server is fetched
|
||||||
@@ -380,6 +392,7 @@ export async function precacheStarterPack(
|
|||||||
...starterPack,
|
...starterPack,
|
||||||
$type: 'app.bsky.graph.defs#starterPackView',
|
$type: 'app.bsky.graph.defs#starterPackView',
|
||||||
list: listView,
|
list: listView,
|
||||||
|
feeds,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user