mirror of
https://github.com/inventree/inventree-app.git
synced 2025-06-13 10:45:29 +00:00
Catch some subtle errors (#202)
- Prevent API requests for invalid PK values - Perform checks for invalid PK values at multiple points - Change order of operations in StockDetail widget
This commit is contained in:
@ -109,13 +109,13 @@ class _StockItemDisplayState extends RefreshableState<StockDetailWidget> {
|
||||
@override
|
||||
Future<void> request(BuildContext context) async {
|
||||
|
||||
final bool result = await item.reload();
|
||||
|
||||
stockShowHistory = await InvenTreeSettingsManager().getValue(INV_STOCK_SHOW_HISTORY, false) as bool;
|
||||
|
||||
final bool result = item.pk > 0 && await item.reload();
|
||||
|
||||
// Could not load this stock item for some reason
|
||||
// Perhaps it has been depleted?
|
||||
if (!result || item.pk == -1) {
|
||||
if (!result) {
|
||||
Navigator.of(context).pop();
|
||||
}
|
||||
|
||||
|
@ -31,7 +31,9 @@ class _StockNotesState extends RefreshableState<StockNotesWidget> {
|
||||
|
||||
@override
|
||||
Future<void> request(BuildContext context) async {
|
||||
await item.reload();
|
||||
if (item.pk > 0) {
|
||||
await item.reload();
|
||||
}
|
||||
}
|
||||
|
||||
@override
|
||||
|
Reference in New Issue
Block a user