-
Notifications
You must be signed in to change notification settings - Fork 1
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
fix: Call showOauthClientsLimitExceeded only when Cookie exists #956
Conversation
When showing OauthClientsLimitExceeded we should ensure that a Session Cookie is set on the app If not, the popup will display a cozy-stack error After the login scenario, when cozy-home does its first render, then no Session Cookie exist yet. In that case we should call `getIndexHtmlForSlug` at least once to generate the Session Cookie So in that case we want to call `showOauthClientsLimitExceeded` only after `getIndexHtmlForSlug` But if a Session Cookie exists, then we want to continue doing the check before calling `getIndexHtmlForSlug` so we prevent unnecessary `getIndexHtmlForSlug` calls (this queries cozy-stack) when OauthClientsLimit is exceeded and when the Session Cookie exists
29c0108
to
d64f725
Compare
if (isOauthClientsLimitExeeded) { | ||
if (slug === 'home') { | ||
showOauthClientsLimitExceeded(href) | ||
return false |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why do we want to render the home even if oauth clients limit is exceeded ?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Here the home will be rendered behind the pop so it won't be visible by the user
We do this to improve user experience so when they fix the number of OAuth client, they will instantaneously go to the home (as it is already loaded)
More generally, we try to always have the homeView loaded for this reason (except when no user is logged)
Note that we do this for the HomeView because it has its own container. We cannot do this for cozy-app because one container is used for all cozy-app, so for example we cannot keep drive and mespapiers loaded simultaneously. But if we could we would have done it.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you for the explanation!
When showing OauthClientsLimitExceeded we should ensure that a Session Cookie is set on the app
If not, the popup will display a cozy-stack error
After the login scenario, when cozy-home does its first render, then no Session Cookie exist yet. In that case we should call
getIndexHtmlForSlug
at least once to generate the Session CookieSo in that case we want to call
showOauthClientsLimitExceeded
only aftergetIndexHtmlForSlug
But if a Session Cookie exists, then we want to continue doing the check before calling
getIndexHtmlForSlug
so we prevent unnecessarygetIndexHtmlForSlug
calls (this queries cozy-stack) when OauthClientsLimit is exceeded and when the Session Cookie exists