tsgrp / HPI

OpenContent Management Suite (OCMS)
http://www.tsgrp.com/products
17 stars 5 forks source link

Enhance consistency of userpreferences #2415

Open dhruvvora94 opened 3 years ago

dhruvvora94 commented 3 years ago

After the enhancements to https://github.com/tsgrp/HPI/issues/2413 the userpreferences save calls only happen when a user -

  1. Closes Browser
  2. Closes Tab
  3. Logs out
  4. Times out

This means that if the user makes some changes to one tab and then opens up a new tab after that - these userpreference changes will not be reflected here. This is because those changes have not been saved to the repo yet.

One way around this could be to tie the save call to the "visibilitychange" event rather than the "onbeforeunload" event - which would also increase the reliability of this call.

This is also the recommended way to use the sendBeacon method - https://developer.mozilla.org/en-US/docs/Web/API/Navigator/sendBeacon