... | ... | @@ -24,5 +24,8 @@ Issue: Ensuring reliable creation, editing, and deletion of grocery items with c |
|
|
Root Cause: The item model required handling various attributes like quantity, expiry date, and categories, which introduced complexity in validation and structure.
|
|
|
Solution: We used a MongoDB schema to define item attributes and created clean API endpoints for item management.
|
|
|
Outcome: The inventory system works reliably, supports all required fields, and is fully integrated with the group and reminder features.
|
|
|
|
|
|
**6. Inventory Navigation Issue**
|
|
|
Issue: When adding/editing/deleting an item to the inventory, the navigation would navigate to the inventory screen, however this was just adding more inventory screens onto the navigation stack. This meant that the when the user pressed the back button to try and go to the homepage, it instead just went back to the previous inventory screen. If a user had added multiple items, then they would have to press the back button multiple times before they could get out of the inventory screen. I tried using navigation.goBack() which did fix the navigation issue but the inventory screen did not update if any changes were made.
|
|
|
Solution: used navigation.goBack(), but also added useFocusEffect in Inventory screen which is a React Navigation Hook which runs the code within it, whenever the screen is focused (navigated to the screen). The code within is a function to fetch items from the database. When a navigation.goBack() is used the useFocusEffect will run as the screen is focused and so the fetchItems function will be called getting the items that are in the database.
|
|
|
Outcome: Inventory screen updates whenever an item is added/removed/modified.
|
|
|
…… |