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

Function updateCachedPagePost

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

Source from the content-addressed store, hash-verified

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