dickinson-comp190 / GitKit-FarmData2-F24

Other
0 stars 2 forks source link

Seeding Input: Duplicates appearing in Area Dropdown #65

Open braughtg opened 2 months ago

braughtg commented 2 months ago

The Area drop down in the Seeding Input form contains duplicates. The same list of areas appears to be being appended to the dropdown multiple times. Each Area should appear in this list only one time.

Steps to Reproduce

  1. Clear browsing data
  2. Visit Seeding Input form
    • Area's will be listed once.
  3. Visit a different tab (e.g. info)
  4. Area list will update with a second copy of all areas.
  5. Each visits to another tab and return to the Seeding Input form will add another copy of the areas to the drop down.

Based on the above behavior this appears to have something to do with the way the caching is done for areas. It should be compared to what is being done for the crops which are not exhibiting the same behavior.


Issue by braughtg Tuesday Jun 07, 2022 at 13:06 GMT Originally opened as https://github.com/DickinsonCollege/FarmData2/issues/460

braughtg commented 2 months ago

Confirmed that this is related to the caching of the areas in the local storage. When the areas are requested each time and not retrieved from cache there is no duplication.


Comment by braughtg Tuesday Jun 07, 2022 at 13:16 GMT

braughtg commented 2 months ago

Issue is that the call to getAllPages appends new responses to the provided array, it does not clear the array. Thus, when the cached version of the area response is used, the subsequent call to the API to check for updates adds to the response, it does not replace the response.


Comment by braughtg Tuesday Jun 07, 2022 at 13:25 GMT