summaryrefslogtreecommitdiff
path: root/addons/website/static/src
diff options
context:
space:
mode:
authorXavier Morel <xmo@openerp.com>2013-11-13 16:18:32 +0100
committerXavier Morel <xmo@openerp.com>2013-11-13 16:18:32 +0100
commit837aa436e5b31a06a8fab1a7bfcfdf97ab877f2b (patch)
treef8fd13137c9d9a767d11c36f82002a22b7b91ab3 /addons/website/static/src
parent6562ab4d764b11b266b18521cdc99ba207178fdf (diff)
[IMP] abort FAYT requests when the next one comes in
bzr revid: xmo@openerp.com-20131113151832-ym4hvpyhn5t7ocxs
Diffstat (limited to 'addons/website/static/src')
-rw-r--r--addons/website/static/src/js/website.editor.js10
1 files changed, 8 insertions, 2 deletions
diff --git a/addons/website/static/src/js/website.editor.js b/addons/website/static/src/js/website.editor.js
index 994876d6c05..245abd9960e 100644
--- a/addons/website/static/src/js/website.editor.js
+++ b/addons/website/static/src/js/website.editor.js
@@ -845,8 +845,9 @@
}),
init: function (editor) {
this._super(editor);
- // url -> name mapping for existing pages
this.text = null;
+ // Store last-performed request to be able to cancel/abort it.
+ this.req = null;
},
start: function () {
var self = this;
@@ -941,7 +942,9 @@
.addBack().removeClass('has-error');
},
fetch_pages: function (term) {
- return openerp.jsonRpc('/web/dataset/call_kw', 'call', {
+ var self = this;
+ if (this.req) { this.req.abort(); }
+ return this.req = openerp.jsonRpc('/web/dataset/call_kw', 'call', {
model: 'website',
method: 'search_pages',
args: [null, term],
@@ -949,6 +952,9 @@
limit: 9,
context: website.get_context()
},
+ }).done(function () {
+ // request completed successfully -> unstore it
+ self.req = null;
});
},
});