mirror of
https://github.com/inventree/inventree-app.git
synced 2025-04-28 05:26:47 +00:00
Bug fix for refreshable state
- Prevent setstate if widget is no longer mounted
This commit is contained in:
parent
19ad3153e4
commit
0165a4bad5
@ -88,8 +88,10 @@ abstract class RefreshableState<T extends StatefulWidget> extends State<T> with
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Refresh the widget - handler for custom request() method
|
||||||
Future<void> refresh(BuildContext context) async {
|
Future<void> refresh(BuildContext context) async {
|
||||||
|
|
||||||
|
// Escape if the widget is no longer loaded
|
||||||
if (!mounted) {
|
if (!mounted) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -100,6 +102,11 @@ abstract class RefreshableState<T extends StatefulWidget> extends State<T> with
|
|||||||
|
|
||||||
await request(context);
|
await request(context);
|
||||||
|
|
||||||
|
// Escape if the widget is no longer loaded
|
||||||
|
if (!mounted) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
setState(() {
|
setState(() {
|
||||||
loading = false;
|
loading = false;
|
||||||
});
|
});
|
||||||
|
Loading…
x
Reference in New Issue
Block a user