@@ -156,21 +156,36 @@ export function ContributorRow({
156156 </ h4 >
157157 < div className = "flex flex-col gap-0 border-t border-[#111111]/20 dark:border-neutral-200/20" >
158158 { user . contributedDocs && user . contributedDocs . length > 0 ? (
159- user . contributedDocs . map ( ( doc ) => (
160- < Link
161- key = { doc . id }
162- href = { doc . url }
163- className = "flex w-full items-center justify-between group/link border-b border-[#111111]/20 dark:border-neutral-200/20 py-3 hover:bg-[#111111]/5 dark:hover:bg-white/5 transition-colors px-2"
164- data-umami-event = "click_contributor_doc"
165- data-umami-event-doc = { doc . title }
166- data-umami-event-user = { user . name }
167- >
168- < span className = "font-mono text-sm text-[#111111] dark:text-neutral-200 group-hover/link:underline decoration-2 decoration-[#CC0000] underline-offset-4 truncate pr-4" >
169- { doc . title }
170- </ span >
171- < ExternalLink className = "h-4 w-4 text-[#111111]/50 dark:text-neutral-400 group-hover/link:text-[#CC0000] transition-colors shrink-0" />
172- </ Link >
173- ) )
159+ ( ( ) => {
160+ // 过滤掉 title 直接等于 id 的脏数据(通常是已被删除或解析失败的文档遗留在数据库中)
161+ const validDocs = user . contributedDocs . filter (
162+ ( doc ) => doc . title !== doc . id ,
163+ ) ;
164+
165+ if ( validDocs . length === 0 ) {
166+ return (
167+ < div className = "text-sm font-body italic text-neutral-500 pt-4" >
168+ No valid document history found.
169+ </ div >
170+ ) ;
171+ }
172+
173+ return validDocs . map ( ( doc ) => (
174+ < Link
175+ key = { doc . id }
176+ href = { doc . url }
177+ className = "flex w-full items-center justify-between group/link border-b border-[#111111]/20 dark:border-neutral-200/20 py-3 hover:bg-[#111111]/5 dark:hover:bg-white/5 transition-colors px-2"
178+ data-umami-event = "click_contributor_doc"
179+ data-umami-event-doc = { doc . title }
180+ data-umami-event-user = { user . name }
181+ >
182+ < span className = "font-mono text-sm text-[#111111] dark:text-neutral-200 group-hover/link:underline decoration-2 decoration-[#CC0000] underline-offset-4 truncate pr-4" >
183+ { doc . title }
184+ </ span >
185+ < ExternalLink className = "h-4 w-4 text-[#111111]/50 dark:text-neutral-400 group-hover/link:text-[#CC0000] transition-colors shrink-0" />
186+ </ Link >
187+ ) ) ;
188+ } ) ( )
174189 ) : (
175190 < div className = "text-sm font-body italic text-neutral-500 pt-4" >
176191 No explicit document history found.
0 commit comments