Fix: Add defensive check to WebVitalsScore and reformat MDX to avoid prerender error
Some checks failed
Build & Deploy / 🔍 Prepare (push) Successful in 7s
Build & Deploy / 🏗️ Build (push) Failing after 9m49s
Build & Deploy / 🚀 Deploy (push) Has been skipped
Build & Deploy / 🩺 Smoke Test (push) Has been skipped
Build & Deploy / 🔔 Notify (push) Successful in 2s

This commit is contained in:
2026-05-05 16:38:46 +02:00
parent a02a419879
commit cb9e136d16
2 changed files with 6 additions and 4 deletions

View File

@@ -16,6 +16,11 @@ interface WebVitalsScoreProps {
}
export const WebVitalsScore: React.FC<WebVitalsScoreProps> = ({ values, description }) => {
if (!values) {
console.error("WebVitalsScore: 'values' prop is missing!");
return null;
}
const getStatus = (metric: 'lcp' | 'inp' | 'cls', value: number): 'good' | 'needs-improvement' | 'poor' => {
if (metric === 'lcp') return value <= 2.5 ? 'good' : value <= 4.0 ? 'needs-improvement' : 'poor';
if (metric === 'inp') return value <= 200 ? 'good' : value <= 500 ? 'needs-improvement' : 'poor';