mirror of
https://gitea.toothfairyai.com/ToothFairyAI/tf_code.git
synced 2026-04-22 00:24:46 +00:00
fix(app): make provider icon resolved id reactive (#15583)
This commit is contained in:
@@ -1,5 +1,5 @@
|
|||||||
import type { Component, JSX } from "solid-js"
|
import type { Component, JSX } from "solid-js"
|
||||||
import { splitProps } from "solid-js"
|
import { createMemo, splitProps } from "solid-js"
|
||||||
import sprite from "./provider-icons/sprite.svg"
|
import sprite from "./provider-icons/sprite.svg"
|
||||||
import { iconNames, type IconName } from "./provider-icons/types"
|
import { iconNames, type IconName } from "./provider-icons/types"
|
||||||
|
|
||||||
@@ -9,7 +9,7 @@ export type ProviderIconProps = JSX.SVGElementTags["svg"] & {
|
|||||||
|
|
||||||
export const ProviderIcon: Component<ProviderIconProps> = (props) => {
|
export const ProviderIcon: Component<ProviderIconProps> = (props) => {
|
||||||
const [local, rest] = splitProps(props, ["id", "class", "classList"])
|
const [local, rest] = splitProps(props, ["id", "class", "classList"])
|
||||||
const resolved = iconNames.includes(local.id as IconName) ? local.id : "synthetic"
|
const resolved = createMemo(() => (iconNames.includes(local.id as IconName) ? local.id : "synthetic"))
|
||||||
return (
|
return (
|
||||||
<svg
|
<svg
|
||||||
data-component="provider-icon"
|
data-component="provider-icon"
|
||||||
@@ -19,7 +19,7 @@ export const ProviderIcon: Component<ProviderIconProps> = (props) => {
|
|||||||
[local.class ?? ""]: !!local.class,
|
[local.class ?? ""]: !!local.class,
|
||||||
}}
|
}}
|
||||||
>
|
>
|
||||||
<use href={`${sprite}#${resolved}`} />
|
<use href={`${sprite}#${resolved()}`} />
|
||||||
</svg>
|
</svg>
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user