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

Function updateCachedPagePost

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

Source from the content-addressed store, hash-verified

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