don't blow up UI on request timeouts
diff --git a/web/ons-demo/js/app.js b/web/ons-demo/js/app.js
index e342213..0d06148 100644
--- a/web/ons-demo/js/app.js
+++ b/web/ons-demo/js/app.js
@@ -1059,21 +1059,23 @@
updateModel(function (newModel) {
// console.log('Update time: ' + (Date.now() - d)/1000 + 's');
- var modelChanged = false;
- if (!model || JSON.stringify(model) != JSON.stringify(newModel)) {
- modelChanged = true;
- model = newModel;
- } else {
-// console.log('no change');
- }
+ if (newModel) {
+ var modelChanged = false;
+ if (!model || JSON.stringify(model) != JSON.stringify(newModel)) {
+ modelChanged = true;
+ model = newModel;
+ } else {
+ // console.log('no change');
+ }
- if (modelChanged) {
- updateControllers();
- updateSelectedFlows();
- updateTopology();
- }
+ if (modelChanged) {
+ updateControllers();
+ updateSelectedFlows();
+ updateTopology();
+ }
- updateHeader(newModel);
+ updateHeader(newModel);
+ }
// do it again in 1s
setTimeout(function () {
diff --git a/web/ons-demo/js/model.js b/web/ons-demo/js/model.js
index 29859a6..5026bd4 100644
--- a/web/ons-demo/js/model.js
+++ b/web/ons-demo/js/model.js
@@ -126,7 +126,8 @@
var model = toD3(results);
cb(model);
} else {
- alert(JSON.stringify(err));
+ console.log(JSON.stringify(err));
+ cb(null);
}
});
}