-
- Downloads
[IMP] bus: use 'pagehide' instead of 'unload' event
The original goal here is to remove the warning of the google page speed but it actually is really better to use 'pagehide' as it is fired more reliably than the 'unload' event and does not prevent Chrome and Firefox to use the bfcache (browser optimization that enables instant back and forward navigation). The persisted property of the pagehide event is checked before disconnecting from the worker. As for the presence/multi_tab case, it was chosen to also consider page freezing as it seems more accurate that what was done before (the main tab could be throttled/frozen which was an issue). Some resources to explain why this is better: - https://web.dev/bfcache/#never-use-the-unload-event - https://developer.mozilla.org/en-US/docs/Web/API/Window/pagehide_event closes odoo/odoo#100976 Signed-off-by:Quentin Smetz (qsm) <qsm@odoo.com> Co-authored-by:
qsm-odoo <qsm@odoo.com>
Showing
- addons/bus/static/src/multi_tab_service.js 2 additions, 2 deletionsaddons/bus/static/src/multi_tab_service.js
- addons/bus/static/src/services/bus_service.js 7 additions, 2 deletionsaddons/bus/static/src/services/bus_service.js
- addons/bus/static/src/services/presence_service.js 1 addition, 1 deletionaddons/bus/static/src/services/presence_service.js
- addons/bus/static/tests/bus_tests.js 4 additions, 4 deletionsaddons/bus/static/tests/bus_tests.js
- addons/bus/static/tests/multi_tab_service_tests.js 7 additions, 7 deletionsaddons/bus/static/tests/multi_tab_service_tests.js
Loading
Please register or sign in to comment