-
Notifications
You must be signed in to change notification settings - Fork 98
fix: in web implementation session token is never used during the place autocomplete #45
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
base: master
Are you sure you want to change the base?
fix: in web implementation session token is never used during the place autocomplete #45
Conversation
ad382e0 to
ad81622
Compare
| } | ||
|
|
||
| AutocompleteSessionToken _getSessionToken({required bool force}) { | ||
| final localToken = _lastSessionToken; |
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.
Could you please elaborate on it a bit?
I need to understand how this code is supposed to work.
According to code, _lastSessionToken is always null just because it's never assigned.
Shouldn't it be something like
return force || _lastSessionToken == null ? (_lastSessionToken = AutocompleteSessionToken()) : _lastSessionToken!;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.
@AndreiMisiukevich ther last session token should be set from the response - not from us.
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.
@AndreiMisiukevich Before, the _lastSessionToken was always null, now on each request we check if the session token is valid and set a new session token if needed: _lastSessionToken is null on first request.
| // https://issuetracker.google.com/issues/36219203 | ||
| log("locationRestriction is not supported: https://issuetracker.google.com/issues/36219203"); | ||
| } | ||
| final sessionToken = _getSessionToken(force: newSessionToken == true); |
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.
| final sessionToken = _getSessionToken(force: newSessionToken == true); | |
| final sessionToken = _getSessionToken(force: newSessionToken ?? 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.
@AndreiMisiukevich it has the same meaning, and == true is what we do in the mobile implementation
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.
@matanshukry Yeah, I got it.
Just think it doesn't look good. But yeah, it's a personal preference, I think. Not a clean code rule :)
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.
I also mentioned that in the comments - but the last session token should be set based on the response -which is missing here.
Also see this: #31 fro the corect usage of the tokens, which it doesn't do.
- If you match the web package to the mobile (missing setting the value from the response) - we'll merge.
- If you prefer to go ahead and impleemnt the correct behavior based on the issue - we can merge that too.
| // https://issuetracker.google.com/issues/36219203 | ||
| log("locationRestriction is not supported: https://issuetracker.google.com/issues/36219203"); | ||
| } | ||
| final sessionToken = _getSessionToken(force: newSessionToken == true); |
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.
@AndreiMisiukevich it has the same meaning, and == true is what we do in the mobile implementation
| } | ||
|
|
||
| AutocompleteSessionToken _getSessionToken({required bool force}) { | ||
| final localToken = _lastSessionToken; |
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.
@AndreiMisiukevich ther last session token should be set from the response - not from us.
|
@AndreiMisiukevich why the install dependencies failed? Which version of flutter is needed? |
|
@mrcsilverfox it's because of the flutter version the CI is using; you can ignore that. |
Do you think that is enough? Or we have to use the completer as used in Although I didn't understand why the session token should be set based on the response. Why can't the session token be set in the |
b7fecf5 to
3dc608f
Compare
3dc608f to
2630d5a
Compare
|
@matanshukry Any updates on this PR? |
|
Any updates? |
In web implementation session token is never used during the place autocomplete