Ensure all fields have labels

Never show an empty string in the results view. This fixes #535 (again).
This commit is contained in:
Andrew Eisenberg
2020-09-29 15:28:00 -07:00
parent 5244a1c3b0
commit 7ca456d6a0

View File

@@ -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 (