From e49f919a197c8297a1f78bfc4230029ab24abebf Mon Sep 17 00:00:00 2001 From: shamoon <4887959+shamoon@users.noreply.github.com> Date: Mon, 13 Oct 2025 13:53:50 -0700 Subject: [PATCH] Check field prop --- src/components/services/widget/block.jsx | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/src/components/services/widget/block.jsx b/src/components/services/widget/block.jsx index 8dc0e8883..9f85bbd18 100644 --- a/src/components/services/widget/block.jsx +++ b/src/components/services/widget/block.jsx @@ -6,22 +6,26 @@ import { evaluateHighlight, getHighlightClass } from "utils/highlights"; import { BlockHighlightContext } from "./highlight-context"; -export default function Block({ value, label }) { +export default function Block({ value, label, field }) { const { t } = useTranslation(); const highlightConfig = useContext(BlockHighlightContext); const highlight = useMemo(() => { if (!highlightConfig) return null; const labels = Array.isArray(label) ? label : [label]; + const candidates = []; + if (typeof field === "string") candidates.push(field); + for (const candidateLabel of labels) { + if (typeof candidateLabel === "string") candidates.push(candidateLabel); + } - for (const candidate of labels) { - if (typeof candidate !== "string") continue; + for (const candidate of candidates) { const result = evaluateHighlight(candidate, value, highlightConfig); if (result) return result; } return null; - }, [label, value, highlightConfig]); + }, [field, label, value, highlightConfig]); const highlightClass = useMemo(() => { if (!highlight?.level) return undefined;