diff --git a/web/app/components/plugins/base/deprecation-notice.tsx b/web/app/components/plugins/base/deprecation-notice.tsx index d567c3f976..36dc73fc20 100644 --- a/web/app/components/plugins/base/deprecation-notice.tsx +++ b/web/app/components/plugins/base/deprecation-notice.tsx @@ -39,6 +39,15 @@ const DeprecationNotice: FC = ({ return snakeCase2CamelCase(deprecatedReason) }, [deprecatedReason]) + // Check if the deprecatedReasonKey exists in i18n + const hasValidDeprecatedReason = useMemo(() => { + if (!deprecatedReason || !deprecatedReasonKey) return false + + // Define valid reason keys that exist in i18n + const validReasonKeys = ['businessAdjustments', 'ownershipTransferred', 'noMaintainer'] + return validReasonKeys.includes(deprecatedReasonKey) + }, [deprecatedReason, deprecatedReasonKey]) + if (status !== 'deleted') return null @@ -54,7 +63,7 @@ const DeprecationNotice: FC = ({
{ - deprecatedReason && alternativePluginId && ( + hasValidDeprecatedReason && alternativePluginId && ( = ({ ) } { - deprecatedReason && !alternativePluginId && ( + hasValidDeprecatedReason && !alternativePluginId && ( {t(`${i18nPrefix}.onlyReason`, { deprecatedReason: t(`${i18nPrefix}.reason.${deprecatedReasonKey}`) })} ) } { - !deprecatedReason && ( + !hasValidDeprecatedReason && ( {t(`${i18nPrefix}.noReason`)} ) }