Scales-Nature-Park / start-native-app

MERN based full stack data entry mobile application and admin desktop application for the START project.
MIT License
1 stars 1 forks source link

Dropdown Selection Bug #47

Closed mbahgatTech closed 2 years ago

mbahgatTech commented 2 years ago

Problem

mbahgatTech commented 2 years ago

The selection doesn't change the state, therefore the data is still valid when submitted to the server. However, the field displays shows the duplicate value in the dropdown under it as well.

mbahgatTech commented 2 years ago

Deleting fields from fields.json results in this problem. Each field you delete from the top results in your duplicate field being pushed 1 dropdown down. Also, initials is the only one that duplicates while others just get pushed to further dropdowns. Seems to be that the fields are still there but not displayed, so that the dropdowns aren't synced with the field names. Not sure how that's possible since displayField takes the whole field as an argument.

mbahgatTech commented 2 years ago

Resolved in ed64658c97ff10cfc9f15ac565227c4fa605824b. The problem was caused when using fields.json file to set the dataFields and then loading them from storage.

For some reason that caused a render conflict where it would render the dropdowns in the order of both arrays and they would have similar or overwriting values, that's why there were duplicates sometimes and not at other times. I've re-implemented the FetchFields function in dataInput screen to only use fields.json values as a backup in case local storage doesn't have fields stored, when loading fields from local storage (ones last fetched from database on last login and downloaded by the user). So now, there will always be exactly one source the data input screen is gonna get its input fields from avoiding this problem.

This is sort of a work around though, preferably this issue should be revisited and dealt with using the previous 2 sources together. The current fetch fields implementation will likely stay the same even if that's fixed. Closing issue until further activity.