Fork me on GitHub
#datascript
<
2015-12-21
>
Daniel Jomphe19:12:38

Coming back with an answer... it was as trivial as looking into Om Next's devcards sources are remarking om/mock-root used there! Here's the gist of it:

(defcard
    (om/mock-root reconciler YourDataScriptBackedComponent))

Daniel Jomphe19:12:07

With that said, I'm not yet sure how we'd use devcard's initial data mechanism to bootstrap the DataScript store.

Daniel Jomphe19:12:27

(Apart from doing it manually.)

Daniel Jomphe19:12:59

At least the following can be done, but evidently, with no standard devcards atom-based storage handling, nor history:

(defcard
  (let [conn (d/create-conn {})
        reconciler (om/reconciler {:state  conn :parser (om/parser {:read read :mutate mutate})})]
    (d/transact! conn [{:db/id -1 :person/first-name "Dan"}])
    (om/mock-root reconciler FirstName)))