This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2021-11-01
Channels
- # announcements (3)
- # babashka (20)
- # beginners (77)
- # calva (27)
- # cider (5)
- # clara (3)
- # clj-kondo (9)
- # cljs-dev (4)
- # cljsrn (5)
- # clojure (26)
- # clojure-europe (32)
- # clojure-italy (5)
- # clojure-nl (3)
- # clojure-uk (5)
- # clojurescript (25)
- # clojureverse-ops (4)
- # core-async (49)
- # cursive (15)
- # data-science (1)
- # datahike (4)
- # datomic (3)
- # docker (1)
- # events (1)
- # helix (5)
- # holy-lambda (3)
- # introduce-yourself (1)
- # jobs (1)
- # kaocha (2)
- # lsp (15)
- # malli (42)
- # off-topic (18)
- # pathom (18)
- # pedestal (12)
- # polylith (7)
- # rdf (1)
- # re-frame (22)
- # reitit (2)
- # releases (1)
- # remote-jobs (1)
- # rewrite-clj (33)
- # shadow-cljs (85)
- # spacemacs (3)
- # vim (12)
- # xtdb (29)
Hi @wilkerlucio, I really enjoyed your data navigation with P3 talk, thanks a lot! It is both a great explanation of the problems with REST (and GraphQL) and a wow-ing demonstration of the powers of Pathom. Certainly going to recommend it further!
I have the same use-case and pass {:db (atom (datomic/db datomic-conn)), :datomic-conn datomic-conn}
as env
. That way I can update :db
with :db-after
during the mutation and use @db
in the resolver.
Does the return of the mutation updates the env? I'm not following how what you are suggesting works.
@U05476190 do you use PathomViz? if you do, how do you remove the datomic data from your env before sending it to Viz?
No, at the moment I'm using P2 and Fulcro inspector (which shows EQL and some perf stats), but not the newest PathomViz which shows env, etc. But I've been following your thread about cleaning up the env data @U0509NKGK and I'm looking forward to a clean approach (and finally getting PathomViz setup and migrating to P3).
I will say the problem seems similar to issues in P2 with it returning indexes that were not serializable, where we just made a custom resolver middleware that dissoc
the pathom-indexes, etc.
@U05094X3J - in the mutation, you want to (reset! (:datomic-db env) db-after)
as a side-effect, and then return whatever you normally return from the mutation; and in the resolver you want to use (deref (:datomic-db env))
as the DB you pass into queries. Since you are storing it as (atom (datomic/db datomic-conn))
the atom takes care of the coordination; and Pathom guarantees read-after-write semantics for "first run mutations, then run resolvers"
it does, ta!
In Pathom 2 you can return a new env in your mutations:
{:com.wsscode.pathom.core/env (assoc env :db db-after)}
Is there something like this env update on pathom3 @wilkerlucio ?
I'm a bit reluctant to add this back, the reason is that I've seen a couple of cases where you end up leaking your env
out by accident, and that is really bad, so I hater find another way to handle those cases, the atom is a valid one that's less risky