Ensure all fields have labels
Never show an empty string in the results view. This fixes #535 (again).
This commit is contained in:
@@ -68,12 +68,6 @@ export function renderLocation(
|
||||
callback?: () => void
|
||||
): JSX.Element {
|
||||
|
||||
if (loc === undefined) {
|
||||
return <span />;
|
||||
} else if (isStringLoc(loc)) {
|
||||
return <a href={loc}>{loc}</a>;
|
||||
}
|
||||
|
||||
// If the label was empty, use a placeholder instead, so the link is still clickable.
|
||||
let displayLabel = label;
|
||||
if (!label) {
|
||||
@@ -82,6 +76,12 @@ export function renderLocation(
|
||||
displayLabel = `[whitespace: "${label}"]`;
|
||||
}
|
||||
|
||||
if (loc === undefined) {
|
||||
return <span>{displayLabel}</span>;
|
||||
} else if (isStringLoc(loc)) {
|
||||
return <a href={loc}>{loc}</a>;
|
||||
}
|
||||
|
||||
const resolvableLoc = tryGetResolvableLocation(loc);
|
||||
if (resolvableLoc !== undefined) {
|
||||
return (
|
||||
|
||||
Reference in New Issue
Block a user