Change parameter type + extract local variable
This commit is contained in:
@@ -98,7 +98,7 @@ export function isStringLoc(loc: UrlValue): loc is string {
|
||||
export function tryGetRemoteLocation(
|
||||
loc: UrlValue | undefined,
|
||||
fileLinkPrefix: string,
|
||||
sourceLocationPrefix: string,
|
||||
sourceLocationPrefix: string | undefined,
|
||||
): string | undefined {
|
||||
const resolvableLocation = tryGetResolvableLocation(loc);
|
||||
if (!resolvableLocation) {
|
||||
|
||||
@@ -48,10 +48,11 @@ const Cell = ({
|
||||
return <span>{convertNonPrintableChars(value.toString())}</span>;
|
||||
case 'object': {
|
||||
const url = tryGetRemoteLocation(value.url, fileLinkPrefix, sourceLocationPrefix);
|
||||
const safeLabel = convertNonPrintableChars(value.label);
|
||||
if (url) {
|
||||
return <Link href={url}>{convertNonPrintableChars(value.label)}</Link>;
|
||||
return <Link href={url}>{safeLabel}</Link>;
|
||||
} else {
|
||||
return <span>{convertNonPrintableChars(value.label)}</span>;
|
||||
return <span>{safeLabel}</span>;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user