arachne 2018-03-01

Hi @luke, in FactUI, if I use rum/defc to create rum components, then (fr/transact! app-state [...]) works good. But, if I use rum/defcs then, I get this error while transacting (Error: No protocol method ISwap.-swap! defined for type cljs.core/PersistentArrayMap: {:rum/args (#object [cljs.core.Atom {:val #factui.impl.session.DatomSession{:delegate #object[clara.rules.engine.LocalSession], :store #factui.impl.store.SimpleStore{:schema {:segment/id {:db/cardinality :db.cardinality/one, :db/valueType :db.type/string}, :localState/name {:db/cardinality :db.cardinality/one, :db/valueType :db.type/string}, :db/index {:db/cardinality :db.cardinality/one, :db/valueType :db.type/boolean}, :book/authors {:db/cardinality :db.cardinality/many, :db/valueType :db.type/ref}, :db/unique {:db/cardinality :db.cardinality/one, :db/valueType :db.type/keyword}, :user/membershipId {:db/cardinality :db.cardinality/one, :db/valueType :db.type/string}, :book/isbn {:db/cardinality :db.cardinality/one, :db/valueType :db.type/string}, :relation/src-entity {:db/cardinality :db.cardinality/one, :db/valueType :db.type/ref}, :currentState/state {:db/cardinality :db.cardinality/one, :db/value…) I am using rum/defcs because I wanted to use my own mixins.

FactUI’s state is different from Rum’s state. It might be the case that FactUI is not (currently) compatible with defcs. Reason being, both of those impose special meaning on the first argument to render

I’d have to dive in to the internals of both to figure out if there’s a way to reconcile them

It might work to just pass them both

Is there a way to get data from a network cal and use it as mixin so that the component can subscribe to that mixin?

both means - app-state and state

(rum/defcs <mixins>
   [rum-state factui-state]
   ....
`

yeah something like that

okay, let me try

it should be possible in theory to have a component with both rum state and factui state

I don’t remember off the top of my head how rum state works

unfortunately I won’t have time to look closely today

but I bet if you look at the implementation for rum/defc and for FactUI’s mixin, you’ll be able to figure it out

oh, the two state funda worked

[rum-state factui-state] style

this is a relief 🙂

hopefully the update semantics work out to be what you were hoping for

might be worth some testing