... | ... | @@ -25,7 +25,7 @@ Root Cause: The item model required handling various attributes like quantity, e |
|
|
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.
|
|
|
…… |
|
|
Issue: Navigating to the inventory screen created multiple stacked instances, requiring users to press 'back' repeatedly to exit.
|
|
|
Root Cause: Improper navigation handling and lack of data refresh upon return.
|
|
|
Solution: Used navigation.goBack() combined with useFocusEffect to refresh inventory data automatically upon returning.
|
|
|
Outcome: Navigation streamlined; inventory updates instantly after item changes. |
|
|
\ No newline at end of file |