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

Function updateCachedPagePost

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

Source from the content-addressed store, hash-verified

420
421export const updateCachedPagePost =
422 (feedQueryKey: QueryKey, queryClient: QueryClient) =>
423 (pageIndex: number, index: number, post: Post): void => {
424 updateCachedPage(feedQueryKey, queryClient, pageIndex, (page) => {
425 const edge = page.edges[index];
426
427 if (!edge) {
428 throw new Error(
429 `Missing feed edge at page ${pageIndex} index ${index} for post update`,
430 );
431 }
432
433 if (isFeedApiPostItem(edge.node)) {
434 // eslint-disable-next-line no-param-reassign
435 edge.node = {
436 ...edge.node,
437 post,
438 };
439
440 return page;
441 }
442
443 // eslint-disable-next-line no-param-reassign
444 edge.node = post;
445 return page;
446 });
447 };
448
449export const removeCachedPagePost =
450 (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