Commit ab683af6 authored by Romain Courteaud's avatar Romain Courteaud

erp5_web_renderjs_ui: reload only when app is sure not losing data

parent 9d7df24f
......@@ -11,6 +11,7 @@
default_state_json_string = JSON.stringify({
panel_visible: false,
service_worker_claimed: false,
app_reload_requested: false,
setting_id: "setting/" + document.head.querySelector(
'script[data-renderjs-configuration="application_title"]'
).textContent,
......@@ -579,7 +580,7 @@
return route(this, 'router', 'redirect', param_list);
})
.allowPublicAcquisition('reload', function reload() {
return location.reload();
this.state.app_reload_requested = true;
})
.allowPublicAcquisition("getUrlParameter", function getUrlParameter(
param_list
......@@ -707,7 +708,8 @@
.allowPublicAcquisition("renderApplication", function renderApplication(
param_list
) {
if (this.state.service_worker_claimed &&
if ((this.state.service_worker_claimed ||
this.state.app_reload_requested) &&
(this.state.notification_options === undefined)) {
// As a new service worker claimed the client,
// reload the page to ensure it uses the lastest gadget versions
......
......@@ -234,7 +234,7 @@
</item>
<item>
<key> <string>serial</string> </key>
<value> <string>994.54001.34070.45704</string> </value>
<value> <string>994.65209.11376.49681</string> </value>
</item>
<item>
<key> <string>state</string> </key>
......@@ -252,7 +252,7 @@
</tuple>
<state>
<tuple>
<float>1631797534.82</float>
<float>1632469996.87</float>
<string>UTC</string>
</tuple>
</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