Commit 54244846 authored by Romain Courteaud's avatar Romain Courteaud

[erp5_web_renderjs_ui] Make URL handling timeout error more developper friendly

parent 90d6cfdf
...@@ -55,12 +55,22 @@ ...@@ -55,12 +55,22 @@
return window.location.replace(hash); return window.location.replace(hash);
} }
function synchronousChangeState(hash) { function timeoutUrlChange() {
changeState(hash);
// prevent returning unexpected response // prevent returning unexpected response
// wait for the hash change to occur // wait for the hash change to occur
// fail if nothing happens // fail if nothing happens
return RSVP.timeout(REDIRECT_TIMEOUT); return new RSVP.Queue()
.push(function () {
return RSVP.timeout(REDIRECT_TIMEOUT);
})
.push(undefined, function () {
throw new Error('URL handling timeout: ' + window.location.hash);
});
}
function synchronousChangeState(hash) {
changeState(hash);
return timeoutUrlChange();
} }
////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////
...@@ -500,6 +510,8 @@ ...@@ -500,6 +510,8 @@
////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////
function routeMethodLess(gadget) { function routeMethodLess(gadget) {
// Nothing. Go to front page // Nothing. Go to front page
// If no frontpage is configured, his may comes from missing configuration on website
// or default HTML gadget modification date more recent than the website modification date
return gadget.getSetting("frontpage_gadget") return gadget.getSetting("frontpage_gadget")
.push(function (result) { .push(function (result) {
return synchronousChangeState( return synchronousChangeState(
...@@ -767,11 +779,7 @@ ...@@ -767,11 +779,7 @@
return this.getCommandUrlFor(options) return this.getCommandUrlFor(options)
.push(function (hash) { .push(function (hash) {
window.location.replace(hash); window.location.replace(hash);
return timeoutUrlChange();
// prevent returning unexpected response
// wait for the hash change to occur
// fail if nothing happens
return RSVP.timeout(REDIRECT_TIMEOUT);
}); });
}) })
......
...@@ -232,7 +232,7 @@ ...@@ -232,7 +232,7 @@
</item> </item>
<item> <item>
<key> <string>serial</string> </key> <key> <string>serial</string> </key>
<value> <string>948.17472.32633.64870</string> </value> <value> <string>952.5855.32841.20582</string> </value>
</item> </item>
<item> <item>
<key> <string>state</string> </key> <key> <string>state</string> </key>
...@@ -250,7 +250,7 @@ ...@@ -250,7 +250,7 @@
</tuple> </tuple>
<state> <state>
<tuple> <tuple>
<float>1452242357.34</float> <float>1466782122.1</float>
<string>UTC</string> <string>UTC</string>
</tuple> </tuple>
</state> </state>
......
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