Closed Smidds closed 5 years ago
I was able to work around this by setting the following:
void onListen() {
if (options.fetchResults) {
controller.add(
QueryResult(
loading: true,
),
);
fetchResults();
}
}
All I've done perform controller.add
at line 53 in observable_query.dart
to set loading
to true
, and now the loading boolean is true when we rebuild the Query widget!
Sweet. I think we just need to get common functionalities running
Describe the bug The loading boolean is only ever true, once. Meaning, if you were to wrap the Query in a StatefulWidget, or a ScopedModelDescendant as in my case, the
build
method causes the Query to fire off its builder, but theresult.loading
is never actually set to true to indicate that the Query is loading again.To Reproduce Steps to reproduce the behavior:
builder
for Query to print out "Loading!" whenresult.loading
is truebuild
methodresult.loading
is never reset totrue
Expected behavior This might be my misunderstanding when it comes to the loading boolean, but I anticipated that
loading
would be set totrue
whenever the Query is fetching data, and especially when the whole widget is rebuilding.Screenshots n/a
Desktop (please complete the following information):
Smartphone (please complete the following information):
Additional context I've done some digging around in the
query.dart
file and I've found that everything appears to initialize as expected when the dependencies change, and the Query widget's internalbuild
method does in fact fire every time we run its StatefulWidget parent'sbuild
method, which does in fact setinitialData: QueryResult { loading: true }
(line 88). My best guess is that this has something to do with not fully closing the stream, or perhaps something to do with the controller? No idea!