Current implementation is hard to understand:
( Especially with shift klick )
What happens when klicking track on map:
Select Interaction will process the klick
add track to select collection ( could be second track when using shift-klick )
visually highlight the selected tracks
Callback function selectTrackAndScroll ( from store ) will be called and mutate $store.state.selectedTrack
FilteredTrackList will listen and manage selection in list
FilteredMap will listen and again mutate select collection -> bad ( clear and set track )
In above step we implicitely manage that we can not select multiple tracks -> not elegant
Possible solutions:
FilteredMap should not watch on changes of selectTrack directly, but instead only update selection collection on request ( e.g. new state in store )
Maybe FilteredMap should be entirely passive and parent SelectTracksPage should watch and send commands? not sure
General problem pattern is:
FilteredMap has a hard time to distinguish between changes coming from map interaction or from store by external trigger
Possible solution: use more states for selected tracks: one for filteredList and a separate one for selected tracks ( that could be only inside FilteredMap )
Current implementation is hard to understand: ( Especially with shift klick )
What happens when klicking track on map:
Possible solutions: FilteredMap should not watch on changes of selectTrack directly, but instead only update selection collection on request ( e.g. new state in store ) Maybe FilteredMap should be entirely passive and parent SelectTracksPage should watch and send commands? not sure
General problem pattern is: FilteredMap has a hard time to distinguish between changes coming from map interaction or from store by external trigger Possible solution: use more states for selected tracks: one for filteredList and a separate one for selected tracks ( that could be only inside FilteredMap )