fix(#382): TypeError r.replace is not a function

This commit is contained in:
Its-treason 2023-10-09 17:56:48 +02:00
parent 159dd90b03
commit c586deeb30

View File

@ -87,7 +87,13 @@ const QueryResult = ({ item, collection, data, width, disableRunEventListener, h
};
const activeResult = useMemo(() => {
if (tab === 'preview' && mode.includes('html') && item.requestSent && item.requestSent.url) {
if (
tab === 'preview' &&
mode.includes('html') &&
item.requestSent &&
item.requestSent.url &&
typeof data === 'string'
) {
// Add the Base tag to the head so content loads properly. This also needs the correct CSP settings
const webViewSrc = data.replace('<head>', `<head><base href="${item.requestSent.url}">`);
return (