Maptio / maptio

http://www.maptio.com
Other
24 stars 5 forks source link

Fix new initiative not being selected #851

Closed rgoj closed 11 months ago

rgoj commented 1 year ago

Issue

Fixes the following issue from #846 :

[USABILITY] When a new sub-circle is added, it's (no longer?) showing on the map and in the circle details pane, let's change that

Description

This turned out to be waaaaaay gnarlier than I anticipated. The NgRx part of the code was working correctly - when a new circle was added, the ID of the selected circle was changed. However, at that stage, the map and the details panel got the newly selected ID... but they still had the old data. So much for partial, incremental changes to state management. This was happening because we only updated the data after saving it to the database - and only if that was successful. I changed the saving code to perform a crude version of optimistic updates... and if the save fails, we now show an alert. Not great. Let's do more testing as this is actually a hugely significant change. Probably a good one... especially as we never showed the saving errors even when they did occur, not great.