Skip to content

Error when transacting empty collections at leaf of Causal Map #16

@bobby

Description

@bobby

There are several reasons why we'd want to start a CausalBase with empty leaf collections, including initializing a new data structure. Currently we're unable to do so.

Repro:

(require '[causal.core :as cause])
(def db (cause/base))
(cause/transact db [[nil nil {:foo {}}]])
=> Error: The cause of this node is not in the tree.
    at new cljs$core$ExceptionInfo (http://localhost:8000/js/compiled/cljs-runtime/cljs.core.js:37198:10)
    at Function.cljs$core$IFn$_invoke$arity$3 (http://localhost:8000/js/compiled/cljs-runtime/cljs.core.js:37259:9)
    at Function.cljs$core$IFn$_invoke$arity$2 (http://localhost:8000/js/compiled/cljs-runtime/cljs.core.js:37255:26)
    at Function.cljs$core$IFn$_invoke$arity$4 (http://localhost:8000/js/compiled/cljs-runtime/causal.collections.shared.js:292:25)
    at Object.causal$protocols$CausalTree$insert$arity$3 (http://localhost:8000/js/compiled/cljs-runtime/causal.collections.map.js:542:79)
    at Function.cljs$core$IFn$_invoke$arity$3 (http://localhost:8000/js/compiled/cljs-runtime/causal.protocols.js:168:19)
    at http://localhost:8000/js/compiled/cljs-runtime/causal.base.core.js:191:32
    at http://localhost:8000/js/compiled/cljs-runtime/cljs.core.js:19649:89
    at Function.cljs$core$IFn$_invoke$arity$3 (http://localhost:8000/js/compiled/cljs-runtime/cljs.core.js:19650:3)
    at Function.cljs$core$IFn$_invoke$arity$3 (http://localhost:8000/js/compiled/cljs-runtime/cljs.core.js:19646:78)

*e
=> #error {:message "The cause of this node is not in the tree.", :data {:causes #{:cause-must-exist}}}

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions