fix(ui-map): reload map data on study revisit #1927
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Description:
We encounter a bug related to how study map data is fetched and displayed.
The current logic checks for the existence of map data based on the
studyId
or the absence of data in the state for the given study.This approach works well when navigating within the same study; map data loads from the state, utilizing previously persisted Redux store data. However, an issue arises when a user exits a study, visits a different study, and then returns to the first study. Despite the expectation for the map to reload, it fails to do so.
This behavior is due to the
isMapsExis
t condition evaluating totrue
thestudyId
exists in the store from the previous visit, preventing the map from reloading.Cause:
The core of the issue lies in the reliance on the mere presence of study map data in the Redux store (isMapsExist) to determine whether to fetch map data. This condition fails to account for user navigations away from and back to a study within the same session, where a fresh fetch of map data may be necessary to ensure accurate and updated displays.
Fix:
To address this, we are introducing a more robust check that not only considers the existence of map data but also accounts for user navigations that necessitate refreshing map data.
This involves adjusting the logic to trigger a data fetch not just based on the absence of data but also under circumstances where a revisit to a study requires fresh data to ensure the map reflects the most current information.