Matico-Platform / matico

An open source platform for building civic tech and geospatial apps
https://matico.app
46 stars 3 forks source link

Map utils refactor #210

Closed nofurtherinformation closed 1 year ago

nofurtherinformation commented 1 year ago

Overview

Refactors map views to be in a hook. Cleans up map view syncing

vercel[bot] commented 1 year ago

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Updated
matico-app-server ✅ Ready (Inspect) Visit Preview Nov 3, 2022 at 3:43PM (UTC)
stuartlynn commented 1 year ago

Hey @michplunkett have been meaning to set something like that up. If you want to take a crack at it, please feel free.

What I have used in the past which has worked pretty well is

While we are thinking about dev tooling as well, it might be worth considering using something akin to comittizen to standardize commit messages and make it easier to produce release notes in future.

Opened a ticket to track this here #211

stuartlynn commented 1 year ago

@nofurtherinformation This looks good. I think the refactor into a separate hook is a good call. More generally, we should think about how we do this kind of variable linking.

Currently, each pane exports it's own variables and linking them together requires some faffing at the pane level. It seems to make more intuitive sense to me to be able to declare derivative variables that are combinations of these base pane variables.

So for example if we have Map 1 and Map 2, the both publish a view_state variable, say view_state_1 and view_state_2. We could implement the joint map state by having these both update a derived variable view_state_derived which the map panes then consume.

This could be useful for other situations as well, for example when we want to combine selections etc. So if we had a scatter plot that someone selected a bunch of datapoints on and a table which they did the same thing, we would probably want to combine both selections in to a single variable and serve that back to anyhting that needs it.

We would need to come up with some grammar about how to combine variables something like

enum CombinationMethod{
   /// The combined variable is whatever variable updated last
   MostRecent,
   /// Merge the two variables 
   Merge,
   /// Difference  the two variables
   Difference
}
struct VariableCombination{
     varaibles: Vec<MaticoVariable>.
     method: CombinationMethod
}

One challenge here is that some combination methods might only apply to some Variable Types.