-
-
Notifications
You must be signed in to change notification settings - Fork 44
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
Clean up and simplify login flow #2271
Comments
I don't think it makes a difference as that entire block is synchronous. However, the answer would be no, not necessarily.
They may look ugly, but I think they're necessary. Besides keeping things in sync, they also help debug issues, as the relevant call is logged this way. Even if the selector is removed (which would remove some debug information), I'd use a named constant and not |
Those seem reasonable |
I've been inspecting the code, and took a look especially at The main area to improve in Then, outside of Unfortunately, I'm not sure there is much to be simplified here (not to say that those opportunities shouldn't be explored, there could be a few), but as an alternative, I propose adding some additional comments and creating a brief |
I'm not convinced they're necessary. After #2294 is merged we should be able to verify this more readily (since the tests will be more stable). I'm also not sure what you mean by "relevant call is logged this way", as the selector will still be logged when you remove the wrapper (sbp logs all these selectors, and right now there are two log statements for the same login action, one for the _private wrapper, and one for the actual selector).
💯
That would be OK, but really would should find a way to reduce the amount of jumping around files that happens, even if it's moving some code from different files into the same file. It's extraordinarily difficult to follow the login flow right now. We need to find a way to simplify this so that we don't intimidate developers (too much). |
They're (they = the queued invocations, not the specific decision to use selectors) necessary because they put a barrier that forces the order of login and logout events. These are external events from the perspective of contracts.
I mean that they'll be logged in order of execution. For example, without using selectors you might see
Agreed, but as I tried to mention earlier, a large part of the 'code' complexity is because the process itself is complex, with several things happening in different locations, and a large part of that is because of SW support, which means the session state goes from the app to the SW and then is broadcasted from the SW to the app. This is not to say that the code couldn't be organised differently, but rather to say that the complexity stems from the parts needed to make it work. |
When you phrase it this way I see your point and especially how this could be useful for the Cypress tests where logins and logouts happen relatively quickly. I agree that at the very least it can't hurt, and in some rare instance might help.
👍
Yes, makes sense. |
Problem
The way logging in right now works is extraordinarily confusing and complicated.
There's events being thrown here and there, event handlers across multiple files, and the whole process involves lots of code in lots of places across
main.js
,controller/actions/identity.js
, andcontroller/app/identity.js
.Solution
main.js
.'CHELONIA_STATE'
and be consistent with the rest of the code (define it as a constant somewhere)sbp('okTurtles.events/emit', CONTRACTS_MODIFIED, Array.from(this.subscriptionSet))
be done at the end of'chelonia/reset'
(afternewState
is applied)?_private
selectors, e.g.'gi.app/identity/_private/login'
etc. Either they are not necessary at all, or they are proven necessary, in which case an anonymous function inside the original selector is preferred.The text was updated successfully, but these errors were encountered: