summaryrefslogtreecommitdiff
path: root/addons/web/static/src
diff options
context:
space:
mode:
authorXavier Morel <xmo@odoo.com>2015-03-10 17:22:35 +0100
committerAaron Bohy <aab@odoo.com>2015-03-20 16:34:42 +0100
commit4b0a8d4096be411b1516f8f89ea3d9950b167cf0 (patch)
tree349e869a9e9083bb52652fddae092eae1cbb1fb8 /addons/web/static/src
parent258673fb314ab1a361c7d9148e190e1b7185ab8b (diff)
[IMP] Web, web_calendar: push_state rendering logic
When a new state is rendered, it is now first appended to a documentFragment, and then appended to the DOM when ready. Doing so, there is no more a intermediate step where two widgets are in the DOM, the new one being appended below. This required a web_calendar fix: Not exactly fixed per-se, apparently when fullcalendar is rendered hidden/out of document it doesn't generate correct range dates, and calls the events callback with invalid dates. The code would blindly take those invalid date, get bits out of them (NaN), generate a timestamp full of NaNs and blindly search() the table with that. Just skip the events callback entirely if the start or end date of the current period is invalid (~isNaN(date.valueOf())).
Diffstat (limited to 'addons/web/static/src')
-rw-r--r--addons/web/static/src/js/action_manager.js9
1 files changed, 7 insertions, 2 deletions
diff --git a/addons/web/static/src/js/action_manager.js b/addons/web/static/src/js/action_manager.js
index d1aa1fe3d06..de0f17691f3 100644
--- a/addons/web/static/src/js/action_manager.js
+++ b/addons/web/static/src/js/action_manager.js
@@ -203,8 +203,13 @@ var ActionManager = Widget.extend({
this.inner_action = new_action;
this.inner_widget = widget;
- // Append the inner_widget and hide the old one
- return $.when(this.inner_widget.appendTo(this.$el)).done(function () {
+ // render the inner_widget in a fragment, and append it to the
+ // document only when it's ready
+ var new_widget_fragment = document.createDocumentFragment();
+ return $.when(this.inner_widget.appendTo(new_widget_fragment)).done(function() {
+ self.$el.append(new_widget_fragment);
+ // Hide the old_widget as it will be removed from the DOM when it
+ // is destroyed
if (old_widget) {
old_widget.$el.hide();
}