Skip to content
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: "Stores" field to not show loading spinner (#4669) #4678

Conversation

WildOrangutan
Copy link
Contributor

What

"simple input text field " was showing loading spinner, even if there were no autocomplete suggestions available.

Any input field, without autocomplete enabled, will now not show loading spinner.

Screenshot

untitled.webm

Fixes bug(s)

Fixes #4669

Loading spinner was showing, even if there were no loading or
suggestions available.

Fixes openfoodfacts#4669
@codecov-commenter
Copy link

codecov-commenter commented Sep 30, 2023

Codecov Report

Merging #4678 (825a333) into develop (da78240) will increase coverage by 0.00%.
Report is 1 commits behind head on develop.
The diff coverage is 0.00%.

@@           Coverage Diff           @@
##           develop   #4678   +/-   ##
=======================================
  Coverage     9.91%   9.91%           
=======================================
  Files          310     310           
  Lines        15798   15795    -3     
=======================================
  Hits          1566    1566           
+ Misses       14232   14229    -3     
Files Coverage Δ
...app/lib/pages/product/simple_input_text_field.dart 0.00% <0.00%> (ø)

... and 10 files with indirect coverage changes

📣 We’re building smart automated test selection to slash your CI/CD build times. Learn more

@@ -79,6 +79,7 @@ class _SimpleInputTextFieldState extends State<SimpleInputTextField> {
if (_manager == null || search.length < widget.minLengthForSuggestions) {
_suggestions[search] = _SearchResults.empty();
} else {
_setLoading(true);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What about _setLoading(false); in the catch?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would say no, since there is a _setLoading(false) call, that will be always called after try-catch block.

But there is a bug here. If exception is thrown, _suggestions[search] will be null, and it will not disable loading and also crash the app on the last return. Will fix it.

Also fixes crash and properly disables loading, when try-catch block throws exception.
Copy link
Contributor

@monsieurtanuki monsieurtanuki left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hi @WildOrangutan!
I haven't tested it but that looks good to me, thank you!

@monsieurtanuki monsieurtanuki merged commit 6fb5e18 into openfoodfacts:develop Oct 2, 2023
6 checks passed
@WildOrangutan WildOrangutan deleted the 4669/store-progress-spinner branch October 2, 2023 15:40
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

"Stores" field should not show a ProgressBar
3 participants