MCPcopy Create free account
hub / github.com/dailydotdev/apps / updateCachedPagePost

Function updateCachedPagePost

packages/shared/src/lib/query.ts:420–445  ·  view source on GitHub ↗
(feedQueryKey: QueryKey, queryClient: QueryClient)

Source from the content-addressed store, hash-verified

418
419export const updateCachedPagePost =
420 (feedQueryKey: QueryKey, queryClient: QueryClient) =>
421 (pageIndex: number, index: number, post: Post): void => {
422 updateCachedPage(feedQueryKey, queryClient, pageIndex, (page) => {
423 const edge = page.edges[index];
424
425 if (!edge) {
426 throw new Error(
427 `Missing feed edge at page ${pageIndex} index ${index} for post update`,
428 );
429 }
430
431 if (isFeedApiPostItem(edge.node)) {
432 // eslint-disable-next-line no-param-reassign
433 edge.node = {
434 ...edge.node,
435 post,
436 };
437
438 return page;
439 }
440
441 // eslint-disable-next-line no-param-reassign
442 edge.node = post;
443 return page;
444 });
445 };
446
447export const removeCachedPagePost =
448 (feedQueryKey: QueryKey, queryClient: QueryClient) =>

Callers 8

useOnPostClickFunction · 0.90
trySetPostReadFunction · 0.90
usePollFunction · 0.90
useFeedFunction · 0.90
usePostFeedbackFunction · 0.90
onUpdateCacheFunction · 0.90
useTranslationFunction · 0.90
updateFeedAndAdsCacheFunction · 0.85

Calls 2

isFeedApiPostItemFunction · 0.90
updateCachedPageFunction · 0.85

Tested by

no test coverage detected