Show More
@@ -24,7 +24,7 b' define(["widgets/js/manager",' | |||
|
24 | 24 | this._buffered_state_diff = {}; |
|
25 | 25 | this.pending_msgs = 0; |
|
26 | 26 | this.msg_buffer = null; |
|
27 |
this. |
|
|
27 | this.state_lock = null; | |
|
28 | 28 | this.id = model_id; |
|
29 | 29 | this.views = []; |
|
30 | 30 | |
@@ -78,15 +78,16 b' define(["widgets/js/manager",' | |||
|
78 | 78 | |
|
79 | 79 | apply_update: function (state) { |
|
80 | 80 | // Handle when a widget is updated via the python side. |
|
81 | var that = this; | |
|
82 | _.each(state, function(value, key) { | |
|
83 | that.key_value_lock = [key, value]; | |
|
84 | try { | |
|
85 |
|
|
|
86 |
|
|
|
87 | that.key_value_lock = null; | |
|
88 |
|
|
|
89 | }); | |
|
81 | this.state_lock = state; | |
|
82 | try { | |
|
83 | var that = this; | |
|
84 | WidgetModel.__super__.set.apply(this, [Object.keys(state).reduce(function(obj, key) { | |
|
85 | obj[key] = that._unpack_models(state[key]); | |
|
86 | return obj; | |
|
87 | }, {})]); | |
|
88 | } finally { | |
|
89 | this.state_lock = null; | |
|
90 | } | |
|
90 | 91 | }, |
|
91 | 92 | |
|
92 | 93 | _handle_status: function (msg, callbacks) { |
@@ -149,12 +150,13 b' define(["widgets/js/manager",' | |||
|
149 | 150 | |
|
150 | 151 | // Delete any key value pairs that the back-end already knows about. |
|
151 | 152 | var attrs = (method === 'patch') ? options.attrs : model.toJSON(options); |
|
152 |
if (this. |
|
|
153 |
var key = this. |
|
|
154 | var value = this.key_value_lock[1]; | |
|
155 |
|
|
|
156 |
|
|
|
157 | } | |
|
153 | if (this.state_lock !== null) { | |
|
154 | var keys = Object.keys(this.state_lock); | |
|
155 | for (var i=0; i<keys.length; i++) | |
|
156 | var key = keys[i]; | |
|
157 | if (attrs[key] === this.state_lock[key]) { | |
|
158 | delete attrs[key]; | |
|
159 | } | |
|
158 | 160 | } |
|
159 | 161 | |
|
160 | 162 | // Only sync if there are attributes to send to the back-end. |
General Comments 0
You need to be logged in to leave comments.
Login now