Skip to content

Commit 9a6cb6a

Browse files
nbradburyclaude
andcommitted
Fallback to rendered title for posts/pages if raw is empty
Some posts/pages may have an empty raw title but a valid rendered title. This ensures dropdown items always show a title when available. Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
1 parent 0e8159f commit 9a6cb6a

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

WordPress/src/main/java/org/wordpress/android/ui/navmenus/data/NavMenuRestClient.kt

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -352,7 +352,10 @@ class NavMenuRestClient @Inject constructor(
352352
is WpRequestResult.Success -> {
353353
appLogWrapper.d(AppLog.T.API, "Fetched ${response.response.data.size} $typeName")
354354
val items = response.response.data.map {
355-
LinkableItemOption(it.id, it.title?.raw ?: "")
355+
val title = it.title?.raw?.takeIf { raw -> raw.isNotBlank() }
356+
?: it.title?.rendered
357+
?: ""
358+
LinkableItemOption(it.id, title)
356359
}
357360
LinkableItemsResult.Success(items)
358361
}

0 commit comments

Comments
 (0)