mirror of
https://github.com/HendrikRauh/inventree-app.git
synced 2026-01-13 03:26:24 +00:00
Check if widget is mounted before calling setstate() (#193)
This commit is contained in:
parent
b7a37e50c5
commit
c5162c1947
6 changed files with 48 additions and 29 deletions
|
|
@ -124,9 +124,12 @@ class _StockItemDisplayState extends RefreshableState<StockDetailWidget> {
|
|||
|
||||
// Request test results (async)
|
||||
item.getTestResults().then((value) {
|
||||
setState(() {
|
||||
// Update
|
||||
});
|
||||
|
||||
if (mounted) {
|
||||
setState(() {
|
||||
// Update
|
||||
});
|
||||
}
|
||||
});
|
||||
|
||||
// Request the number of attachments
|
||||
|
|
@ -135,9 +138,12 @@ class _StockItemDisplayState extends RefreshableState<StockDetailWidget> {
|
|||
"stock_item": item.pk.toString()
|
||||
}
|
||||
).then((int value) {
|
||||
setState(() {
|
||||
attachmentCount = value;
|
||||
});
|
||||
|
||||
if (mounted) {
|
||||
setState(() {
|
||||
attachmentCount = value;
|
||||
});
|
||||
}
|
||||
});
|
||||
|
||||
// Request information on labels available for this stock item
|
||||
|
|
@ -169,8 +175,9 @@ class _StockItemDisplayState extends RefreshableState<StockDetailWidget> {
|
|||
}
|
||||
}
|
||||
|
||||
setState(() {
|
||||
});
|
||||
if (mounted) {
|
||||
setState(() {});
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue