Skip to content

Commit ca797d1

Browse files
author
minjk-bl
committed
Fix Snippets bug on init env
1 parent 4736010 commit ca797d1

File tree

1 file changed

+17
-14
lines changed

1 file changed

+17
-14
lines changed

visualpython/js/m_apps/Snippets.js

Lines changed: 17 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -666,21 +666,23 @@ define([
666666
// load udf list to table 'vp_udfList'
667667
let loadingSpinner = new LoadingSpinner($(this.wrapSelector('.vp-sn-table')));
668668
vpConfig.getData().then(function(udfObj) {
669-
vpLog.display(VP_LOG_TYPE.DEVELOP, udfObj);
669+
vpLog.display(VP_LOG_TYPE.DEVELOP, 'Snippets get data', udfObj);
670670
var snippets = new com_String();
671-
Object.keys(udfObj).forEach(key => {
672-
let obj = udfObj[key];
673-
if (obj.code != null && obj.code != undefined) {
674-
675-
var hasImported = false;
676-
if (that.importedList.includes(key)) {
677-
// set new label
678-
hasImported = true;
671+
if (udfObj !== undefined) {
672+
Object.keys(udfObj).forEach(key => {
673+
let obj = udfObj[key];
674+
if (obj.code != null && obj.code != undefined) {
675+
676+
var hasImported = false;
677+
if (that.importedList.includes(key)) {
678+
// set new label
679+
hasImported = true;
680+
}
681+
var item = that.renderSnippetItem(key, obj.code, obj.timestamp, hasImported);
682+
snippets.append(item);
679683
}
680-
var item = that.renderSnippetItem(key, obj.code, obj.timestamp, hasImported);
681-
snippets.append(item);
682-
}
683-
});
684+
});
685+
}
684686
$(that.wrapSelector('.vp-sn-table')).html(snippets.toString());
685687

686688
// bind snippet item
@@ -693,7 +695,8 @@ define([
693695
that.bindCodeMirror(title, tag);
694696
});
695697
}).catch(function(err) {
696-
com_util.renderAlertModal(err);
698+
// com_util.renderAlertModal(err);
699+
vpLog.display(VP_LOG_TYPE.ERROR, err);
697700
}).finally(function() {
698701
loadingSpinner.remove();
699702
});

0 commit comments

Comments
 (0)