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

Function updateCachedPagePost

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

Source from the content-addressed store, hash-verified

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