You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Describe the bug
Contacts page could end up loading the previously loaded contact if a contact change is received just prior to the contact being de-selected.
Expected behavior
The selected contact shouldn't be changed the the previously selected contact.
Environment
Instance: GHA Virtual machine
App: webapp
Version: 3.12
Additional context
I added helper logs in the code, so I better understand what's going on, and reran the test locally until I got a failure. This is what is happening:
routing to contact "health_center_uuid"
selecting contact "health_center_uuid"
set selected contact "health_center_uuid"
contact receives external change "health_center_uuid"
selecting contact "health_center_uuid"
set selected contact null <- navigating away from the contact content page, in the case of the test, we route to contact-edit to add a new contact
set selected contact "health_center_uuid" <- the callback from the external change contact load updates the state with the old contact, so the next time we load the contacts content component, the state is actually dirty!
routing to contact "clinic_uuid" <- loading another contact
selecting contact "clinic_uuid"
contact receives external change "health_center_uuid" <- because the state is dirty when we load the component, the code reacts to a change of the previously selected contact
selecting contact "health_center_uuid"
set selected contact "clinic_uuid"
set selected contact "health_center_uuid"
The text was updated successfully, but these errors were encountered:
Stores the contact ID we want to load. Then as promises resolve, it checks that the contact we want to load is the same as from the data we had retrieved.
Describe the bug
Contacts page could end up loading the previously loaded contact if a contact change is received just prior to the contact being de-selected.
To Reproduce
This is very hard to reproduce with actual usage, but it has been causing a wdio e2e test to fail intermittently.
Example of failure is: https://github.com/medic/cht-core/runs/3297387483?check_suite_focus=true#step:18:282
This failure is quite common (once every 10 suites?).
Expected behavior
The selected contact shouldn't be changed the the previously selected contact.
Environment
Additional context
I added helper logs in the code, so I better understand what's going on, and reran the test locally until I got a failure. This is what is happening:
The text was updated successfully, but these errors were encountered: