( path: string, meta: RecentPageMeta, )
| 71 | }; |
| 72 | |
| 73 | export 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 | |
| 97 | export const recordRecentPage = (entry: RecentPage): void => { |
| 98 | if (typeof window === 'undefined' || !entry.path || !entry.title) { |
no test coverage detected