cgrand / enlivez

8 stars 0 forks source link

`:state` maps shouldn't be query maps #32

Closed cgrand closed 5 years ago

cgrand commented 5 years ago

Query maps make for awkward state maps for two reasons: 1/ A query may return 0, 1 or n results but for a state entity we expect strictly one component 2/ Defaults are defaults, if an attribute value is retracted then the default is back on; this is a counter intuitive behavior to me.

State maps should be more like entity maps, they should only use (in values) symbols which are part of the component's key, so that the initialization state is stable.

This would also allow for many-valued attributes to be set too.

cgrand commented 5 years ago

Okay definitely, it's a hindrance to have these weird :state maps.

The main one is that the state entity does exist but has no attr so non-local queries becomes awkward (defaults everywhere etc.).

Thus when a state template is instantiated it's entity must be transacted and be available to child queries.

cgrand commented 5 years ago

closed by 15cfcdba97f3b5dd9f95a4fb35ab5dce6ca2e951