Skip to content

Commit 8c36e69

Browse files
fix: crash when checking for new dashboard release without internet connection (#2015)
1 parent d1a5ff4 commit 8c36e69

File tree

1 file changed

+12
-7
lines changed

1 file changed

+12
-7
lines changed

Parse-Dashboard/app.js

+12-7
Original file line numberDiff line numberDiff line change
@@ -9,13 +9,18 @@ var fs = require('fs');
99
const currentVersionFeatures = require('../package.json').parseDashboardFeatures;
1010

1111
var newFeaturesInLatestVersion = [];
12-
packageJson('parse-dashboard', { version: 'latest', fullMetadata: true }).then(latestPackage => {
13-
if (latestPackage.parseDashboardFeatures instanceof Array) {
14-
newFeaturesInLatestVersion = latestPackage.parseDashboardFeatures.filter(feature => {
15-
return currentVersionFeatures.indexOf(feature) === -1;
16-
});
17-
}
18-
});
12+
packageJson('parse-dashboard', { version: 'latest', fullMetadata: true })
13+
.then(latestPackage => {
14+
if (latestPackage.parseDashboardFeatures instanceof Array) {
15+
newFeaturesInLatestVersion = latestPackage.parseDashboardFeatures.filter(feature => {
16+
return currentVersionFeatures.indexOf(feature) === -1;
17+
});
18+
}
19+
})
20+
.catch(() => {
21+
// In case of a failure make sure the final value is an empty array
22+
newFeaturesInLatestVersion = [];
23+
});
1924

2025
function getMount(mountPath) {
2126
mountPath = mountPath || '';

0 commit comments

Comments
 (0)