This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2019-12-18
Channels
- # adventofcode (9)
- # alda (2)
- # babashka (89)
- # beginners (86)
- # bristol-clojurians (1)
- # calva (54)
- # chestnut (2)
- # cider (18)
- # clj-kondo (19)
- # clojure (160)
- # clojure-brasil (2)
- # clojure-europe (6)
- # clojure-italy (8)
- # clojure-nl (46)
- # clojure-spec (52)
- # clojure-uk (45)
- # clojured (4)
- # clojuredesign-podcast (11)
- # clojurescript (15)
- # core-async (50)
- # datomic (41)
- # devops (3)
- # emacs (10)
- # fulcro (95)
- # graalvm (11)
- # graphql (3)
- # kaocha (1)
- # luminus (1)
- # malli (4)
- # off-topic (13)
- # overtone (3)
- # pathom (8)
- # re-frame (13)
- # reitit (10)
- # shadow-cljs (83)
- # spacemacs (2)
- # specter (9)
- # tools-deps (3)
- # vim (2)
Is it advisable to call my parser within a mutation, for example if I want to call other mutations I've registered?
I suggest instead you make the mutations more atomic like. they are a final entry point, its better if you abstract the internals so you can share that between mutations, makes sense?
@U066U8JQJ yep, definitely. Is it common to do other parser queries within mutations? Like lets say I need to know the current state of something. Or should the parser be considered more of an interface for the outside world and internally use whatever storage i’m building against to query for things?
@U0CLLU3QT you usually don't need it, the response of a mutation usually has some data about what was transacted, if the user do a mutation join (running a query against the result), them pathom will already trigger the resolver engine to consolidate the gap between the mutation output and the user data, this is what I see happening most of the time
(let [register [(pc/resolver `foo
{::pc/output [::foo]}
(fn [{::keys [foo]} _]
{::foo foo}))
(pc/resolver `parser
{::pc/output [::parser]}
(fn [{:keys [parser] :as env} _]
{::parser [(parser (assoc env ::foo 1)
[::foo])
;; how do I "cleanup" env cache here?
(parser (assoc env ::foo 2)
[::foo])]}))]
p (p/parser
{::p/env {::p/reader [p/map-reader
pc/reader2
pc/open-ident-reader
p/env-placeholder-reader]
::p/placeholder-prefixes #{">"}}
::p/plugins [(pc/connect-plugin {::pc/register register})]})]
(p {} [::parser]))
How do I control/cleanup env
cache?