mirror of
https://gitea.toothfairyai.com/ToothFairyAI/tf_code.git
synced 2026-03-31 22:32:28 +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 { splitProps } from "solid-js"
|
||||
import { createMemo, splitProps } from "solid-js"
|
||||
import sprite from "./provider-icons/sprite.svg"
|
||||
import { iconNames, type IconName } from "./provider-icons/types"
|
||||
|
||||
@@ -9,7 +9,7 @@ export type ProviderIconProps = JSX.SVGElementTags["svg"] & {
|
||||
|
||||
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"
|
||||
const resolved = createMemo(() => (iconNames.includes(local.id as IconName) ? local.id : "synthetic"))
|
||||
return (
|
||||
<svg
|
||||
data-component="provider-icon"
|
||||
@@ -19,7 +19,7 @@ export const ProviderIcon: Component<ProviderIconProps> = (props) => {
|
||||
[local.class ?? ""]: !!local.class,
|
||||
}}
|
||||
>
|
||||
<use href={`${sprite}#${resolved}`} />
|
||||
<use href={`${sprite}#${resolved()}`} />
|
||||
</svg>
|
||||
)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user