Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Entity included in a pull result by virtue of isComponent not reacting to change #19

Open
charles-dyfis-net opened this issue Jan 24, 2017 · 1 comment

Comments

@charles-dyfis-net
Copy link

Given the following setup:

(require '[datascript.core :as d])

(def test-schema
{:db/ident {:db/unique :db.unique/identity},
  :one/name {:db/cardinality :db.cardinality/one},
  :one/parts
  {:db/valueType :db.type/ref,
   :db/cardinality :db.cardinality/many,
   :db/isComponent true},
  :two/name {:db/cardinality :db.cardinality/one}})

(def conn (d/create-conn test-schema))

(d/transact! conn [
  {:db/id -1, :one/name "Hello", :one/parts -2},
  {:db/id -2, :two/name "World"}
])

...and the following ultra-minimal view:

(require '[posh.reagent :as p])
(require '[reagent.core :as r])
(require '[goog.dom :as gdom])
(p/posh! conn)
(defn app [conn]
  (let [state @(p/pull conn '[*] 1)]
     [:div (pr-str state)]))
(r/render-component [app conn] (gdom/getElement "app"))

...the view then contains both elements:

{:db/id 1, :one/name "Hello", :one/parts [{:db/id 2, :two/name "World"}]}

...and is correctly rerendered when the following transaction occurs:

(d/transact! conn [{:db/id 1, :one/name "Goodbye"}])

...but not this one:

(d/transact! conn [{:db/id 2, :two/name "Y'all"}])
@eoliphan
Copy link

eoliphan commented Nov 30, 2017

I'm having this problem as well. I pull a deeply nested structure, but updating something down the tree, doesn't kick off a reaction.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants