mpdairy / posh

A luxuriously simple and powerful way to make front-ends with DataScript and Reagent in Clojure.
Eclipse Public License 1.0
460 stars 45 forks source link

0.5.6 breaks posh/pull #36

Open metasoarous opened 5 years ago

metasoarous commented 5 years ago

I realize that the README suggests the most recent version is 0.5.5. However, I ran lein ancient and it updated to 0.5.6, and it appears that this version has some breakage with respect to posh/pull. It seems that this behavior is specific to pull because posh/q works fine.

The error cropping up in the console is something about get_db not being able to be called on null.

Quezion commented 4 years ago

@metasoarous Do you have any other details on what broke? A basic pull test works, but I don't have any advanced usage to check against.

(deftest test-basic-pull-reaction
  (testing "Basic pull returns entity reaction which updates on entity's transact"
    (let [conn (dt/create-conn)
          _ (d/posh! conn)
          tran (d/transact! conn [{:a "foo" :b 42}])
          eid (->> (d/q '[:find ?e
                          :where [?e :a "foo"]] conn)
                   deref
                   ffirst)
          entity-reaction (d/pull conn '[*] eid)]
      (is (= (select-keys @entity-reaction [:a :b])
             {:a "foo" :b 42}) "entity-reaction derefs to first transacted value")
      (d/transact! conn [{:a "baz" :b 42}])
      (is (= (select-keys @entity-reaction [:a :b])
             {:a "foo" :b 42}) "entity-reaction contains correct value after unrelated tx")
      (d/transact! conn [(assoc @entity-reaction :a "bar" :b 43)])
      (is (= (select-keys @entity-reaction [:a :b])
             {:a "bar" :b 43}) "entity-reaction derefs to later transacted value"))))