This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2022-01-27
Channels
- # announcements (1)
- # aws (10)
- # babashka (53)
- # calva (133)
- # clj-kondo (46)
- # cljdoc (6)
- # cljs-dev (33)
- # clojure (105)
- # clojure-boston (1)
- # clojure-europe (11)
- # clojure-nl (4)
- # clojure-poland (1)
- # clojure-switzerland (6)
- # clojure-uk (13)
- # clojurescript (106)
- # cursive (1)
- # datascript (2)
- # emacs (13)
- # events (1)
- # figwheel-main (4)
- # fulcro (17)
- # graphql (8)
- # heroku (2)
- # honeysql (8)
- # lsp (76)
- # luminus (30)
- # malli (12)
- # meander (23)
- # music (1)
- # nextjournal (83)
- # off-topic (6)
- # pathom (3)
- # polylith (19)
- # re-frame (8)
- # reagent (2)
- # reveal (3)
- # shadow-cljs (54)
- # sql (9)
- # testing (11)
- # tools-deps (15)
- # xtdb (14)
Hey. I thought it would be a good idea to put my datascript db inside of my global app-state ratom. Basically (defonce app-db (r/atom {}))
and then (defonce conn (r/cursor app-db [:ds-db]))
. And then finally I want to use posh so I tried (posh.reagent/posh! conn)
. I get an error Error: Assert failed: (atom? (:listeners (meta conn)))
. I can https://github.com/tonsky/datascript/blob/master/src/datascript/core.cljc#L447 that a datascript atom has :listeners
meta. If I try adding meta to the cursor then I get another error.
(vary-meta conn merge {:listeners (atom {})})
No protocol method IWithMeta.-with-meta defined for type reagent.ratom/RCursor: [object Object]
Is this really a bad idea? How can I make this work?
Thanks!
Error: Assert failed: (atom? (:listeners (meta conn)))
at Function.eval [as cljs$core$IFn$_invoke$arity$3] (core.cljc:592:1)
at Object.posh$plugin_base$set_conn_listener_BANG_ [as set_conn_listener_BANG_] (plugin_base.cljc:29:7)
at eval (plugin_base.cljc:62:37)
at eval (plugin_base.cljc:63:53)
at Function.eval [as cljs$core$IFn$_invoke$arity$variadic] (plugin_base.cljc:63:53)
at posh$plugin_base$posh_BANG_ (plugin_base.cljc:47:1)
at Object.G__10337__1 (core.cljs:4345:12)
at Object.G__10337 [as posh_BANG_] (core.cljs:4348:16)
at eval (app.cljs:128:2)
at eval (<anonymous>)
Never mind. It works fine https://github.com/reagent-project/reagent/pull/562.