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
|
|
@ -91,9 +91,9 @@ class _PartDisplayState extends RefreshableState<PartDetailWidget> {
|
|||
Future<void> onBuild(BuildContext context) async {
|
||||
refresh(context);
|
||||
|
||||
setState(() {
|
||||
|
||||
});
|
||||
if (mounted) {
|
||||
setState(() {});
|
||||
}
|
||||
}
|
||||
|
||||
@override
|
||||
|
|
@ -123,8 +123,9 @@ class _PartDisplayState extends RefreshableState<PartDetailWidget> {
|
|||
|
||||
// Request part test templates
|
||||
part.getTestTemplates().then((value) {
|
||||
setState(() {
|
||||
});
|
||||
if (mounted) {
|
||||
setState(() {});
|
||||
}
|
||||
});
|
||||
|
||||
// Request the number of attachments
|
||||
|
|
@ -133,9 +134,11 @@ class _PartDisplayState extends RefreshableState<PartDetailWidget> {
|
|||
"part": part.pk.toString(),
|
||||
}
|
||||
).then((int value) {
|
||||
setState(() {
|
||||
attachmentCount = value;
|
||||
});
|
||||
if (mounted) {
|
||||
setState(() {
|
||||
attachmentCount = value;
|
||||
});
|
||||
}
|
||||
});
|
||||
|
||||
// Request the number of BOM items
|
||||
|
|
@ -144,9 +147,11 @@ class _PartDisplayState extends RefreshableState<PartDetailWidget> {
|
|||
"in_bom_for": part.pk.toString(),
|
||||
}
|
||||
).then((int value) {
|
||||
setState(() {
|
||||
bomCount = value;
|
||||
});
|
||||
if (mounted) {
|
||||
setState(() {
|
||||
bomCount = value;
|
||||
});
|
||||
}
|
||||
});
|
||||
|
||||
// Request the number of variant items
|
||||
|
|
@ -155,9 +160,11 @@ class _PartDisplayState extends RefreshableState<PartDetailWidget> {
|
|||
"variant_of": part.pk.toString(),
|
||||
}
|
||||
).then((int value) {
|
||||
setState(() {
|
||||
variantCount = value;
|
||||
});
|
||||
if (mounted) {
|
||||
setState(() {
|
||||
variantCount = value;
|
||||
});
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue