viur-framework/viur-vi

Don't bug the server with frequent /vi/user/view/self requests when logged out

tsteinruecken opened this issue · 0 comments

I often see periodic calls to /vi/user/view/self in the logs that are discarded with 401 Unauthorized. This (in my opinion) happens when an VI is keept is a background tab and the System awakes from suspend. My suggestion is to use the new Page Visibility API (https://developer.mozilla.org/en-US/docs/Web/API/Page_Visibility_API) to check whenever the page is actually visible to the user and not issue any further checks to /vi/user/view/self unless the page has become visible again.

Screenshot_20200806_150939