👁️
5
fork

Configure Feed

Select the types of activity you want to include in your feed.

prefetch social for decklist asap

+12 -5
+12 -5
src/routes/profile/$did/deck/$rkey/index.tsx
··· 53 53 export const Route = createFileRoute("/profile/$did/deck/$rkey/")({ 54 54 component: DeckEditorPage, 55 55 loader: async ({ context, params }) => { 56 - // Prefetch deck data during SSR 56 + const deckUri = 57 + `at://${params.did}/${DECK_LIST_NSID}/${params.rkey}` as const; 58 + 59 + // Start social stats prefetch immediately (only needs params) 60 + const socialPromise = prefetchSocialStats( 61 + context.queryClient, 62 + deckUri, 63 + "deck", 64 + ); 65 + 66 + // Prefetch deck data, then cards (needs deck.cards) 57 67 const { deck } = await context.queryClient.ensureQueryData( 58 68 getDeckQueryOptions(params.did as Did, asRkey(params.rkey)), 59 69 ); 60 70 61 - const deckUri = 62 - `at://${params.did}/${DECK_LIST_NSID}/${params.rkey}` as const; 63 71 const cardIds = deck.cards.map((card) => card.scryfallId); 64 - 65 72 await Promise.all([ 66 73 prefetchCards(context.queryClient, cardIds), 67 - prefetchSocialStats(context.queryClient, deckUri, "deck"), 74 + socialPromise, 68 75 ]); 69 76 70 77 return deck;