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

Function trySetPostRead

packages/shared/src/hooks/useOnPostClick.ts:178–195  ·  view source on GitHub ↗
(queryKey: QueryKey, id: string)

Source from the content-addressed store, hash-verified

176 }
177 } else if (!feedName && shouldUseListFeedLayout) {
178 const trySetPostRead = (queryKey: QueryKey, id: string) => {
179 const updateFeedPost = updateCachedPagePost(
180 queryKey as unknown[],
181 client,
182 );
183
184 const data = client.getQueryData(
185 queryKey,
186 ) as InfiniteData<FeedData>;
187
188 const { post: foundPost, page, index } = findPost(data, id);
189 if (foundPost) {
190 updateFeedPost(page, index, {
191 ...foundPost,
192 ...mutationHandler(),
193 });
194 }
195 };
196
197 getFeedQueryKeys(client).forEach((key) => {
198 trySetPostRead(key, post.id);

Callers 1

useOnPostClickFunction · 0.85

Calls 3

updateCachedPagePostFunction · 0.90
findPostFunction · 0.70
mutationHandlerFunction · 0.70

Tested by

no test coverage detected