Currently I am walking through the Contact Manager tutorial of Aurelia v1 again.
I have an issue with the code logic in section
Adding Pub/Sub Messaging. It seems that the implemented pub/sub messaging with EventAggregator does not fix all the issues that are described at the start of that section.
When making a change to a contact and then attempting to navigate away but cancelling the confirmation message, the contact details of the “dirty” contact remain visible in the details view (as expected), but the selected item in the contact list does change to the newly clicked contact. (Subsequently clicking on any other contact in the list will keep asking for a confirmation for navigating away, until either the dirty contact itself is selected in the list again, the dirty contact’s changes are saved using the Save button, or the confirmation for navigating away is accepted by pressing its OK button.)
When debugging the behavior in the browser, it seems to me that the
select(contact) method in the contact list viewmodel is called several times during this process. First with the correct value (by the EventAggregator’s subscribed callback function), but then once again with the wrong value (due to continued event handling in the contact-list component?)
Or have I missed something else, perhaps?