2
0
mirror of https://github.com/inventree/inventree-app.git synced 2025-04-28 05:26:47 +00:00

More debug (#405)

* Extra options for sentry

* Use string comparison

* Catch error when constructing related field

* Include field name in debug
This commit is contained in:
Oliver 2023-07-23 09:55:08 +10:00 committed by GitHub
parent 2e2e9640d4
commit b044c53d91
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 42 additions and 20 deletions

View File

@ -4,6 +4,7 @@
- Enable label printing for stock locations
- Enable label printing for parts
- Updated translation support
- Bug files
### 0.12.5 - July 2023
---

View File

@ -513,7 +513,7 @@ class APIFormField {
isFilterOnline: true,
showSearchBox: true,
itemBuilder: (context, item, isSelected) {
return _renderRelatedField(item, isSelected, true);
return _renderRelatedField(name, item, isSelected, true);
},
emptyBuilder: (context, item) {
return _renderEmptyResult();
@ -566,7 +566,7 @@ class APIFormField {
}
},
dropdownBuilder: (context, item) {
return _renderRelatedField(item, true, false);
return _renderRelatedField(name, item, true, false);
},
onSaved: (item) {
if (item != null) {
@ -582,15 +582,32 @@ class APIFormField {
return false;
}
return item["pk"] == selectedItem["pk"];
return item["pk"].toString() == selectedItem["pk"].toString();
});
}
// Render a "related field" based on the "model" type
Widget _renderRelatedField(dynamic item, bool selected, bool extended) {
Widget _renderRelatedField(String fieldName, dynamic item, bool selected, bool extended) {
// Convert to JSON
var data = Map<String, dynamic>.from((item ?? {}) as Map);
Map<String, dynamic> data = {};
try {
data = Map<String, dynamic>.from((item ?? {}) as Map);
} catch (error, stackTrace) {
data = {};
sentryReportError(
"_renderRelatedField", error, stackTrace,
context: {
"method": "_renderRelateField",
"field_name": fieldName,
"item": item.toString(),
"selected": selected.toString(),
"extended": extended.toString(),
}
);
}
switch (model) {
case "part":

View File

@ -70,3 +70,7 @@ flutter:
- assets/sounds/barcode_scan.mp3
- assets/sounds/barcode_error.mp3
- assets/sounds/server_error.mp3
sentry:
upload_debug_symbols: true
upload_source_maps: true