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

Function updateCachedPagePost

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

Source from the content-addressed store, hash-verified

447
448export const updateCachedPagePost =
449 (feedQueryKey: QueryKey, queryClient: QueryClient) =>
450 (pageIndex: number, index: number, post: Post): void => {
451 updateCachedPage(feedQueryKey, queryClient, pageIndex, (page) => {
452 const edge = page.edges[index];
453
454 if (!edge) {
455 throw new Error(
456 `Missing feed edge at page ${pageIndex} index ${index} for post update`,
457 );
458 }
459
460 if (isFeedApiPostItem(edge.node)) {
461 // eslint-disable-next-line no-param-reassign
462 edge.node = {
463 ...edge.node,
464 post,
465 };
466
467 return page;
468 }
469
470 // eslint-disable-next-line no-param-reassign
471 edge.node = post;
472 return page;
473 });
474 };
475
476export const removeCachedPagePost =
477 (feedQueryKey: QueryKey, queryClient: QueryClient) =>

Callers 8

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

Calls 2

isFeedApiPostItemFunction · 0.90
updateCachedPageFunction · 0.85

Tested by

no test coverage detected