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

Function updateCachedPagePost

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

Source from the content-addressed store, hash-verified

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