Show More
@@ -93,7 +93,12 b' define([' | |||||
93 |
|
93 | |||
94 | WidgetManager.prototype.create_view = function(model, options) { |
|
94 | WidgetManager.prototype.create_view = function(model, options) { | |
95 | // Creates a promise for a view of a given model |
|
95 | // Creates a promise for a view of a given model | |
96 | return utils.load_class(model.get('_view_name'), model.get('_view_module'), |
|
96 | ||
|
97 | // Make sure the view creation is not out of order with | |||
|
98 | // any state updates. | |||
|
99 | model.state_change = model.state_change.then(function() { | |||
|
100 | console.log('create_view ' + model.id); | |||
|
101 | return utils.load_class(model.get('_view_name'), model.get('_view_module'), | |||
97 | WidgetManager._view_types).then(function(ViewType) { |
|
102 | WidgetManager._view_types).then(function(ViewType) { | |
98 |
|
103 | |||
99 | // If a view is passed into the method, use that view's cell as |
|
104 | // If a view is passed into the method, use that view's cell as | |
@@ -109,6 +114,8 b' define([' | |||||
109 | view.render(); |
|
114 | view.render(); | |
110 | return view; |
|
115 | return view; | |
111 | }, utils.reject("Couldn't create a view for model id '" + String(model.id) + "'")); |
|
116 | }, utils.reject("Couldn't create a view for model id '" + String(model.id) + "'")); | |
|
117 | }); | |||
|
118 | return model.state_change; | |||
112 | }; |
|
119 | }; | |
113 |
|
120 | |||
114 | WidgetManager.prototype.get_msg_cell = function (msg_id) { |
|
121 | WidgetManager.prototype.get_msg_cell = function (msg_id) { |
@@ -81,9 +81,8 b' define(["widgets/js/manager",' | |||||
81 | this.trigger('msg:custom', msg.content.data.content); |
|
81 | this.trigger('msg:custom', msg.content.data.content); | |
82 | break; |
|
82 | break; | |
83 | case 'display': |
|
83 | case 'display': | |
84 | this.state_change = this.state_change.then(function () { |
|
84 | that.widget_manager.display_view(msg, that) | |
85 | return that.widget_manager.display_view(msg, that); |
|
85 | .catch(utils.reject("Couldn't process display msg for model id '" + String(that.id) + "'", true)); | |
86 | }).catch(utils.reject("Couldn't process display msg for model id '" + String(that.id) + "'", true)); |
|
|||
87 | break; |
|
86 | break; | |
88 | } |
|
87 | } | |
89 | }, |
|
88 | }, | |
@@ -94,6 +93,8 b' define(["widgets/js/manager",' | |||||
94 | return this._unpack_models(state).then(function(state) { |
|
93 | return this._unpack_models(state).then(function(state) { | |
95 | that.state_lock = state; |
|
94 | that.state_lock = state; | |
96 | try { |
|
95 | try { | |
|
96 | console.log('set_state ' + that.id); | |||
|
97 | console.log(state); | |||
97 | WidgetModel.__super__.set.call(that, state); |
|
98 | WidgetModel.__super__.set.call(that, state); | |
98 | } finally { |
|
99 | } finally { | |
99 | that.state_lock = null; |
|
100 | that.state_lock = null; |
General Comments 0
You need to be logged in to leave comments.
Login now