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

Function updateRecentPageMeta

packages/shared/src/lib/recentPages.ts:73–95  ·  view source on GitHub ↗
(
  path: string,
  meta: RecentPageMeta,
)

Source from the content-addressed store, hash-verified

71};
72
73export const updateRecentPageMeta = (
74 path: string,
75 meta: RecentPageMeta,
76): void => {
77 if (typeof window === 'undefined' || !path || !meta.image) {
78 return;
79 }
80
81 const current = getRecentPages();
82 const index = current.findIndex((page) => page.path === path);
83 if (index === -1) {
84 pendingMeta.set(path, meta);
85 return;
86 }
87
88 if (current[index].image === meta.image) {
89 return;
90 }
91
92 const next = [...current];
93 next[index] = { ...next[index], ...meta };
94 persist(next);
95};
96
97export const recordRecentPage = (entry: RecentPage): void => {
98 if (typeof window === 'undefined' || !entry.path || !entry.title) {

Callers 1

useRecentPageMetaFunction · 0.90

Calls 2

getRecentPagesFunction · 0.85
persistFunction · 0.70

Tested by

no test coverage detected