Fork me on GitHub
#fulcro
<
2018-12-11
>
Andreas Liljeqvist12:12:00

I am trying to use pathom with make-websockets. Given a random query(not defined a resolver), should I get a traceback with Pathom? I can only see fulcro stuff atm.

Andreas Liljeqvist12:12:50

Hmm. Since raise-response takes parser as input pathom might have run but just left something unexpected. Error Don't know how to create ISeq from: clojure.core.async.impl.channels.ManyToManyC

Andreas Liljeqvist14:12:34

Is it even possible to use pathom with fulcro websockets?

wilkerlucio14:12:29

should be, to get the trace you have to ask for it (in you query), you query for :com.wsscode.pathom/trace and it will be provided, its not always there because there is a cost to compute and send it, so it should only be used for dev/debug

Andreas Liljeqvist14:12:23

On the client, must I use pfn/pathom-remote as :remote or is that optional?

Andreas Liljeqvist14:12:32

Asking because fw/make-websocket-networking have to be passed as remote

wilkerlucio14:12:09

I never tried with websocket, you might need to do some work, what the pathom/remote does is implement the Fulcro remote interface to call a parser directly, I'm not familiar with websockets but I guess it uses a different interface, so you have to implement that

wilkerlucio14:12:51

pathom/remote is only for local parsers, are you running your parser in the browser or in a service?

Andreas Liljeqvist14:12:42

Server using pathom to resolve. Client using fulcro with (fc/new-fulcro-client {:networking {:remote (fw/make-websocket-networking)}). Some example in pathom docs indicated one should setup pathom/remote as :remote on client

Andreas Liljeqvist14:12:21

But I have only set Pathom as parser on server

wilkerlucio14:12:14

pathom/remote is just for local parsers (running on the browser)

Andreas Liljeqvist14:12:58

ok, so a standard fulcro client shouldn't have to do anything special? Only server?

Andreas Liljeqvist14:12:11

Ok, thanks for your help. Bummer though that fulcro-websockets doesn't work out of the box, as Pathom is highly encouraged by Fulcro. (Not a critique, just a statement)

wilkerlucio14:12:48

yeah, its a mater of usage I think, we are a very limited number of people working on those, so we prioritise things we are currently using, just happen that websockets are not so much a requirement in most cases, so it needs more love, I can help you answering questions if you like to make that easier, its certainly desirable (maybe just need better docs), just didn't got prioritised yet 🙂

Andreas Liljeqvist11:12:40

Certainly makes sense to implement for the most people. On the other hand Tony thinks it should work, so I am probably doing something wrong

Björn Ebbinghaus14:12:16

I use an API client library, which returns core.async channels. Is there a prefered way to use async channels in mutations? Is it bad, if the state change happens asynchronous?

wilkerlucio14:12:49

your mutation local code should only do sync things changing the local, any async operation should be delegated to the remote, that you can use async as you will wish (use mutation returns or other loads to sync that back on your app db later)

wilkerlucio14:12:07

if you are using pathom on the client it can handle async operations and integrate nicely with fulcro

tony.kay15:12:03

@andreas862 I’m using pathom with websockets on 3 projects, I think

tony.kay15:12:48

(def parser
  (p/parser
    {::p/mutate     server/server-mutate
     ::p/fail-fast? false
     ::p/plugins    [(p/env-wrap-plugin (fn [env]
                                          (assoc env ::pc/indexes @indexes
                                                     :config s.config/config
                                                     :sql-dbspec {:dbtype     "postgresql"
                                                                  :datasource (:ucv s.sql/connection-pools)}
                                                     :connection s.database/connection)))
                     (p/env-plugin {::p/reader               [p/map-reader
                                                              pc/reader2
                                                              pc/ident-reader
                                                              (p/placeholder-reader ">")]
                                    ::p/placeholder-prefixes #{">"}
                                    ::pc/resolver-dispatch   resolver-fn
                                    ::p/process-error        process-error})
                     p/request-cache-plugin
                     pp/profile-plugin
                     p/error-handler-plugin
                     (preprocess-parser-plugin log-requests)
                     (preprocess-parser-plugin add-current-info)
                     (p/post-process-parser-plugin p/elide-not-found)]}))
(:require             [fulcro.websockets :as fw])

(defstate websockets
  :start
  (let [websockets (fw/make-websockets
                     s.parser/parser
                     {:http-server-adapter (get-sch-adapter)
                      :sente-options       {:user-id-fn user-id-fn}})]
    (component/start websockets))
  :stop
  (component/stop websockets))

Andreas Liljeqvist11:12:44

Thanks! Of course my problem was that I used the parallell-parser. Now to learn the rest of Pathom..

tony.kay16:12:23

Have not upgraded to latest Sente…it has bug fixes for csrf (that my code works around…I reported the security hole in Sente)…there is an open issue to make sure the upgrade works, but perhaps that is your problem?

eric.shao16:12:07

How to use @keyframes in co-css in cljs?

tony.kay16:12:13

@eric.shao See garden docs…you have to declare them outside

tony.kay16:12:28

don’t remember the details…

tony.kay16:12:39

there’s like a defkeyframes or something

tony.kay16:12:45

search for keyframes

eric.shao16:12:25

@tony.kay Thank you. find it.

(defkeyframes my-animation
  [:from
   {:background "red"}]

  [:to
   {:background "yellow"}])

(css
  my-animation ;; Include the animation in the stylesheet.
  [:div
   {:animation [[my-animation "5s"]]}])"