Open jomo opened 5 years ago
It has historic reasons: The single source of truth about what's selected is in the event div's classes, if they're selected, that means that you've selected them, which allows for some trivial aggregation. Then there's the list in localStorage which is your final list that's supposed to match what's on the server and that's later reused to set the initial selections once you come back to the site.
Now we'd need to immediately store selections and de-selections in a list in localStorage and check if it differs from the one that's a cache of what we believe is on the server. That list also may differ from what's actually on the server unless we add some more synchronization code.
All in all it's a major change in the model and I hesitate to do that on the live system now :)
Is there a reason the selected events are only locally stored when submitted? IMO it would be better to store them whenever an event is selected. This allows you to close the tab (including accidentally) and come back later to finish the selection.