Skip to content

Commit 7bb1d88

Browse files
committed
fix: bugsnag errors
1 parent bf0fc47 commit 7bb1d88

2 files changed

Lines changed: 17 additions & 10 deletions

File tree

src/document/DocumentManager.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -343,8 +343,8 @@ define(function (require, exports, module) {
343343
var result = new $.Deferred(),
344344
promise = result.promise();
345345

346-
// return null in case of untitled documents
347-
if (fullPath.indexOf(_untitledDocumentPath) === 0) {
346+
// return null in case of untitled documents or cannot resolve file name
347+
if ((!fullPath && !fileObj) || (fullPath && fullPath.indexOf(_untitledDocumentPath) === 0)) {
348348
result.resolve(null);
349349
return promise;
350350
}

src/extensionsIntegrated/Phoenix-live-preview/NodeStaticServer.js

Lines changed: 15 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -607,15 +607,22 @@ define(function (require, exports, module) {
607607
}
608608

609609
function getTabPopoutURL(url) {
610-
let openURL = new URL(url);
611-
// we tag all externally opened urls with query string parameter phcodeLivePreview="true" to address
612-
// #LIVE_PREVIEW_TAB_NAVIGATION_RACE_FIX
613-
openURL.searchParams.set(PHCODE_LIVE_PREVIEW_QUERY_PARAM, "true");
614-
if(_staticServerInstance && utils.isHTMLFile(openURL.pathname) && url.startsWith(_staticServerInstance.getBaseUrl())){
615-
// this is a live preview html with in built navigation, so we can sever it as is.
616-
return openURL.href;
610+
let urlToOpen = url;
611+
try{
612+
let openURL = new URL(url);
613+
// we tag all externally opened urls with query string parameter phcodeLivePreview="true" to address
614+
// #LIVE_PREVIEW_TAB_NAVIGATION_RACE_FIX
615+
openURL.searchParams.set(PHCODE_LIVE_PREVIEW_QUERY_PARAM, "true");
616+
if(_staticServerInstance && utils.isHTMLFile(openURL.pathname)
617+
&& url.startsWith(_staticServerInstance.getBaseUrl())){
618+
// this is a live preview html with in built navigation, so we can sever it as is.
619+
return openURL.href;
620+
}
621+
urlToOpen = openURL.href;
622+
} catch (e) {
623+
console.error("Error getting tab popout url", e);
617624
}
618-
return _getPageLoaderURL(openURL.href);
625+
return _getPageLoaderURL(urlToOpen);
619626
}
620627

621628
function hasActiveLivePreviews() {

0 commit comments

Comments
 (0)