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

Function updateCachedPagePost

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

Source from the content-addressed store, hash-verified

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