Fork me on GitHub
#datascript
<
2018-06-14
>
denis_krivosheev04:06:27

@petterik the thing is, I am the maintainer of re-posh. Wanted to try rum with it but turns out it’s not that simple. I have an idea of a view and storage agnostic data-management library, but have to verify what we already have.

💯 1
petterik16:06:50

Oh I didn't know that! 👋

denis_krivosheev04:06:06

I experimented a little bit yesterday. The idea is, I have the query and I can listen to transactions instead of full database. So when transaction is done and I have its summary, I can execute query against transaction datamos instead of whole database. And If I have any result from it, then rerun the query to the database. Aaand for queries it’s complitely wrong 😔 But maybe can be ok for pull subscriptions. If the transaction has the id we are interested in or a pair of unique props and any of the field from pattern, then rerun pull and rerender subscribed components

denis_krivosheev04:06:46

Another idea is that subscription itself can declare, which event CAN update subscription’s query. So the logic here 1) When somebody started listen to the query or pull, execute it and put the result into the atom. 2) When event with transaction effect is triggered, find the listening subsciptions (pull or query) and reexecute them 3) Put the new result of execution into the subscription atom

denis_krivosheev05:06:05

something like

(reg-sub :cool-query-sub
  {:type :query
   :query '[:find ... :where ...]
   :variables [var1 var2]
   :watch-events [:event1 :event2]})
and then (subscibe [:qool-query-sub])