SurfSense/surfsense_web/components/tool-ui/citation
guangyang1206 f096548a16 fix(web): extract single tryGetHostname helper (DRY, unified fallback)
Fixes #1368

Previously,  was duplicated in 4 places with 3 subtly different fallback behaviors:
1. inline-citation.tsx: returned  on error
2. markdown-text.tsx: returned  on error
3. assistant-message.tsx: returned  on error
4. citation.tsx: returned  on error

Created canonical  in  that:
- Returns
- Strips  prefix from hostname
- Returns  on invalid URL (safest contract)

Updated all 4 call sites:
- inline-citation.tsx:  (preserves original fallback)
- markdown-text.tsx:  (preserves original fallback)
- assistant-message.tsx:  (drop-in, both return )
- citation.tsx:  (drop-in, both return )

Co-authored-by: guangyang1206 <guangyang1206@users.noreply.github.com>
2026-05-16 12:15:16 +08:00
..
_adapter.tsx chore: ran linting 2026-03-30 01:50:41 +05:30
citation-list.tsx refactor: extract shared TYPE_ICONS into dedicated module 2026-04-14 23:22:29 -07:00
citation.tsx fix(web): extract single tryGetHostname helper (DRY, unified fallback) 2026-05-16 12:15:16 +08:00
index.ts chore: ran linting 2026-03-30 01:50:41 +05:30
schema.ts chore: ran linting 2026-03-30 01:50:41 +05:30
type-icons.ts refactor: extract shared TYPE_ICONS into dedicated module 2026-04-14 23:22:29 -07:00