-
Notifications
You must be signed in to change notification settings - Fork 555
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
Use resolvedConnection where available #1111
Use resolvedConnection where available #1111
Conversation
Thanks for the PR. Do you think it makes sense to add this to the signup as well? |
@luisrudge Hmm -- probably. If I think back to when I implemented my |
Great! What did you mean about the tests? Why can't you add tests for this? |
I'm happy to add tests, I am just not sure where in the project I should add them. Would you be able to direct me? |
actually, now that I'm taking a look at this, this PR will fix the same issue. we're only missing two tests (here) to merge it. Can you help with those tests? I'm focusing on the other PRs right now. The PR changes from resolving the connection |
I might be wrong, but my current understanding is that this PR is orthogonal to #1087. It looks like the onBlur / onSubmit callback only sets the resolved connection. But that resolved connection gets ignored unless explicitly asked for in the functions in |
You're totally correct. I was taking a look at the PR and thought it was fixing the same issue. Sorry about that. |
src/connection/database/index.js
Outdated
const customResolvedConnection = l.resolvedConnection(lock); | ||
const standardConnection = databaseConnection(lock); | ||
const connection = customResolvedConnection || standardConnection || {}; | ||
return connection.name; |
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.
You can't directly access .name
here because it's an Immutable object.
it should be someting like
const connection = customResolvedConnection || standardConnection || new Map();
return connection.get('name');
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.
.
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.
Gotcha
src/connection/database/index.js
Outdated
const customResolvedConnection = l.resolvedConnection(lock); | ||
const standardConnection = databaseConnection(lock); | ||
const connection = customResolvedConnection || standardConnection || {}; | ||
return connection.name; |
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.
.
It looks like I need to push this logic further to the core. There are other functions like |
src/connection/database/index.js
Outdated
export function databaseConnectionName(m) { | ||
return (databaseConnection(m) || Map()).get('name'); | ||
export function databaseConnectionName(lock) { | ||
const connection = databaseConnection(lock) || new Map(); |
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.
you can rollback this changes entirely
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.
okiedoke
Ok -- I believe comments are addressed. |
Thanks for the PR and patience 🎉 |
Thanks very much @luisrudge! |
Looks like the
connectionResolver
option was added in 10.19 to allow control over which connection to authenticate against duringlogIn
. We've been using this feature since its release, and it's worked well so far.We've noticed that
resetPassword
does not respect this function, and this can result in some really confusing behavior. For users whose default connection is overridden by theconnectionResolver
, they could be logging into one connection but resetting their password in another. And so their interaction with the Lock might go as follows:I looked at the original
connectionResolver
PR (#1052) to get my bearings in the project. I was hoping to mirror some test cases forresetPassword
, but I only saw new pane tests, which I believe should remain unchanged in this PR. Let me know if there are any changes you'd like to see here, and I'll try to update ASAP.Thanks!