fix: override stale DB iso2 with registry for known defunct nations
The DB still holds old codes (su, yu) from before the null mapping was added. TeamFlag now checks TEAM_ISO by name first so the registry wins over any stale value the DB returns. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -1,4 +1,4 @@
|
||||
import { getIso } from '@/lib/iso-codes'
|
||||
import { TEAM_ISO, getIso } from '@/lib/iso-codes'
|
||||
|
||||
interface Props {
|
||||
name: string
|
||||
@@ -17,7 +17,9 @@ const placeholderSize = {
|
||||
}
|
||||
|
||||
export function TeamFlag({ name, iso2, size = 'md', className = '' }: Props) {
|
||||
const code = iso2 !== undefined ? iso2 : getIso(name)
|
||||
// If the name is in our registry, trust it over the DB value (which may be stale).
|
||||
// For unknown teams, fall back to the DB iso2.
|
||||
const code = name in TEAM_ISO ? TEAM_ISO[name] : (iso2 ?? getIso(name))
|
||||
|
||||
if (!code) {
|
||||
const abbr = name
|
||||
|
||||
Reference in New Issue
Block a user