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

Function updateCachedPagePost

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

Source from the content-addressed store, hash-verified

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