Skip to content

Commit a197f69

Browse files
committed
fix(devtools): remove optional chaining for textContent in SEO tab components
This commit updates the json-ld-preview and links-preview components by removing optional chaining from the textContent property. This change ensures that the textContent is always trimmed, improving the handling of empty strings and enhancing the robustness of the SEO tab components.
1 parent 2fc42a1 commit a197f69

File tree

2 files changed

+2
-2
lines changed

2 files changed

+2
-2
lines changed

packages/devtools/src/tabs/seo-tab/json-ld-preview.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -330,7 +330,7 @@ function analyzeJsonLdScripts(): Array<JsonLdEntry> {
330330
)
331331

332332
return scripts.map((script, index) => {
333-
const raw = script.textContent?.trim() || ''
333+
const raw = script.textContent.trim() || ''
334334
if (raw.length === 0) {
335335
return {
336336
id: `jsonld-${index}`,

packages/devtools/src/tabs/seo-tab/links-preview.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ type LinkRow = {
2424
function classifyLink(anchor: HTMLAnchorElement): LinkRow {
2525
const href = anchor.getAttribute('href')?.trim() || ''
2626
const text =
27-
anchor.textContent?.trim() ||
27+
anchor.textContent.trim() ||
2828
anchor.getAttribute('aria-label')?.trim() ||
2929
anchor.getAttribute('title')?.trim() ||
3030
''

0 commit comments

Comments
 (0)