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

Function updateCachedPagePost

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

Source from the content-addressed store, hash-verified

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