fix(app): fallback to synthetic icon for unknown provider IDs (#15295)

This commit is contained in:
mridul
2026-03-01 02:43:23 +05:30
committed by GitHub
parent 2a2082233d
commit 971bd30516
8 changed files with 16 additions and 33 deletions

View File

@@ -1,14 +1,15 @@
import type { Component, JSX } from "solid-js"
import { splitProps } from "solid-js"
import sprite from "./provider-icons/sprite.svg"
import type { IconName } from "./provider-icons/types"
import { iconNames, type IconName } from "./provider-icons/types"
export type ProviderIconProps = JSX.SVGElementTags["svg"] & {
id: IconName
id: string
}
export const ProviderIcon: Component<ProviderIconProps> = (props) => {
const [local, rest] = splitProps(props, ["id", "class", "classList"])
const resolved = iconNames.includes(local.id as IconName) ? local.id : "synthetic"
return (
<svg
data-component="provider-icon"
@@ -18,7 +19,7 @@ export const ProviderIcon: Component<ProviderIconProps> = (props) => {
[local.class ?? ""]: !!local.class,
}}
>
<use href={`${sprite}#${local.id}`} />
<use href={`${sprite}#${resolved}`} />
</svg>
)
}