set onChangedField function to only update options with new results
Added function and result identifiers into the RawAutocomplete onChangedField method, now the options value will not be updated if the data is from an optionsBuilder call older than the last call which updated the options
List which issues are fixed by this PR. You must list at least one issue. An issue is not required if the PR fixes something trivial like a typo. Issue #150774 is fixed by this PR
If you had to change anything in the flutter/tests repo, include a link to the migration guide as per the breaking change policy.
Pre-launch Checklist
- [x] I read the Contributor Guide and followed the process outlined there for submitting PRs.
- [x] I read the Tree Hygiene wiki page, which explains my responsibilities.
- [x] I read and followed the Flutter Style Guide, including Features we expect every widget to implement.
- [x] I signed the CLA.
- [x] I listed at least one issue that this PR fixes in the description above.
- [x] I updated/added relevant documentation (doc comments with
///). - [x] I added new tests to check the change I am making, or this PR is test-exempt.
- [x] I followed the breaking change policy and added Data Driven Fixes where supported.
- [x] All existing and new tests are passing.
If you need help, consider asking for advice on the #hackers-new channel on Discord.
It looks like this pull request may not have tests. Please make sure to add tests before merging. If you need an exemption to this rule, contact "@test-exemption-reviewer" in the #hackers channel in Chat (don't just cc them here, they won't see it! Use Discord!).
If you are not sure if you need tests, consider this rule of thumb: the purpose of a test is to make sure someone doesn't accidentally revert the fix. Ask yourself, is there anything in your PR that you feel it is important we not accidentally revert back to how it was before your fix?
Reviewers: Read the Tree Hygiene page and make sure this patch meets those guidelines before LGTMing.
@mohsinraza-fdev Could you please add a test as indicated by the bot message above to make sure we never regress this? Thank you.
@mohsinraza-fdev Could you please add a test as indicated by the bot message above to make sure we never regress this? Thank you.
on it
@mohsinraza-fdev Could you please add a test as indicated by the bot message above to make sure we never regress this? Thank you.
Test added.
There may be a more complete solution in progress by @victorsanni (#147900 and/or #148995). This PR should probably be on hold until we figure out those bigger changes.
Sorry for the confusion @mohsinraza-fdev. I'll assign @victorsanni to #150774 now. I appreciate you submitting your issue and this PR. We'll see if we can move forward with this or if we have to close it.
Sure
I talked to @victorsanni offline and his PR should cover this, but we'll revisit it after his PR is merged and double check. If not then we can move forward with this PR. Sorry again for the duplicate work here.
Hi @mohsinraza-fdev are you still working on this pr?
Hi @mohsinraza-fdev are you still working on this pr?
Yep, waiting for a reply from @justinmc
Remved the result id and added a new test, @justinmc @victorsanni can you please review the changes.
LGTM! Thanks for the being patient with the review back-and-forth.
Not a problem, I appreciate the guidance and feedback throughout the review process. Looking forward to contributing more in the future!
@victorsanni Google testing check failed, do you have any idea what could be the issue?
@victorsanni Google testing check failed, do you have any idea what could be the issue?
I am investigating this.
Justin is out until Wednesday, so this would have to wait until then anyways.
LGTM :+1:
The Google test failure seems urelated somehow. It's failing here:
https://github.com/flutter/flutter/blob/93b55edff14a47f24471de69ff2a9ef1b15ef6ff/packages/flutter/lib/src/material/scaffold.dart#L326-L330
I would tell you to push a merge commit and let the Google tests run again, but have you already tried that?
Ya i've tried that, let me push a merge commit again.
Ok thanks, in the meantime I'm going to do a deeper look at the failure with @victorsanni.
The failure in the Google tests seems to be legit, or at least it is truly caused by the change in this PR. I think we'll have to fix the test and this PR can stay as-is. Then we will set the Google tests to passing if all goes well.
The failure in the Google tests seems to be legit, or at least it is truly caused by the change in this PR. I think we'll have to fix the test and this PR can stay as-is. Then we will set the Google tests to passing if all goes well.
Oh okay 👍
Hi @mohsinraza-fdev, I and Justin have been investigating the test failures.
From what we can see, the failure happens when the results of optionsBuilder is not deterministic. For example, optionsBuilder(x) is called twice, and the options returned the second time is different from the first time, possibly because the options being returned is dependent on some extrinsic state. (cc @justinmc if there's more context you can provide).
If you can try reproducing this, it would go a long way towards helping us know what to do to move forward with the PR.
Thanks for your patience.
Hi @mohsinraza-fdev, I and Justin have been investigating the test failures.
From what we can see, the failure happens when the results of
optionsBuilderis not deterministic. For example,optionsBuilder(x)is called twice, and the options returned the second time is different from the first time, possibly because the options being returned is dependent on some extrinsic state. (cc @justinmc if there's more context you can provide).If you can try reproducing this, it would go a long way towards helping us know what to do to move forward with the PR.
Thanks for your patience.
How do i identify the failure, can i run google test myself? i tried removing a random list item from every optionsBuilder output, from what i have observed, if optionsBuilder is called more than once with the same input, and the value return from the second call is different from the first one, the items in the dropdown don't change their values
-> optionsBuilder('O') -> returns ['Olives', 'Orange'] -> Dropdown shows ['Olives', 'Orange']
calls again..
-> optionsBuilder('O') -> returns ['Olallieberry', 'Ogallala strawberry'] -> Dropdown still shows ['Olives', 'Orange']
Is this whats causing the issue? 🤔
Is this whats causing the issue? 🤔
Does this also happen without the changes in this PR? If no, that might be it.
Is this whats causing the issue? 🤔
Does this also happen without the changes in this PR? If no, that might be it.
yep it doesn't happen without the changes in this pr.
okay so before this PR the dropdown used to update on every change, so when i would enter -> 'OR' -> wait for result.. -> |Backspace|, 'R'
-> the dropdown updates on the 'O' left in the textfield and then on 'OR' again
But after the update
-> the call on 'O' after |Backspace| is blocked from updating the dropdown and the optionsBuilder resolves again for 'OR'
something is stopping the dropdown values from updating just because they are from the same keyword, last result was from.
Ill try to resolve this