From f07b877a49ecfd57b01cee273a8094a75cd08ae3 Mon Sep 17 00:00:00 2001 From: Lenz Weber-Tronic Date: Wed, 21 Jan 2026 10:03:31 +0100 Subject: [PATCH] Update logger example to account for `CompilerDiagnostic` in `CompilerError.details` `event.detail` in the logger example could either be `CompilerErrorDetail` or `CompilerDiagnostic`, yet the example only handled the simpler (but deprecated) `CompilerErrorDetail`. This adds a call to `primaryLocation` (if present) to account for the different structure of `CompilerDiagnostic` - `loc` is not present there. --- src/content/reference/react-compiler/logger.md | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/content/reference/react-compiler/logger.md b/src/content/reference/react-compiler/logger.md index 41e2a1da064..4ed99a8a5ac 100644 --- a/src/content/reference/react-compiler/logger.md +++ b/src/content/reference/react-compiler/logger.md @@ -102,8 +102,9 @@ Get specific information about compilation failures: console.error(`Details: ${event.detail.description}`); } - if (event.detail.loc) { - const { line, column } = event.detail.loc.start; + const loc = event.detail.primaryLocation?.() || event.detail.loc; + if (loc) { + const { line, column } = loc.start; console.error(`Location: Line ${line}, Column ${column}`); }