Commit 37d8708f authored by Thomas Gambier's avatar Thomas Gambier 🚴🏼 Committed by Rafael Monnerat

[slapos_jio] fix rjs_gadget_erp5_page_slap_intent.js

render function should take 0 time otherwise, it may be called several times by
parent function.  In this javascript, the render function is actually
requesting a software release, so we don't want it to be called several
times...

/reviewed-on !118
parent 93046594
...@@ -56,7 +56,18 @@ ...@@ -56,7 +56,18 @@
return this.element.querySelector('button[type="submit"]').click(); return this.element.querySelector('button[type="submit"]').click();
}) })
// prevent render from being called several times by using "onStateChange"
// which won't be called several times if options didn't change
// also use a declareJob to let the function finish immediately
// (gadget.redirect is actually waiting indefinitely) so that parent is
// happy and doesn't try to call render again
.declareMethod("render", function (options) { .declareMethod("render", function (options) {
return this.changeState(options);
})
.onStateChange(function (options) {
this.deferRender(options);
})
.declareJob("deferRender", function (options) {
var gadget = this; var gadget = this;
if (options.intent !== "request") { if (options.intent !== "request") {
throw new Error("Intent not supported"); throw new Error("Intent not supported");
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment