Fork me on GitHub
#pathom
<
2019-07-04
>
michal10:07:09

hey there, just a general question regarding pathom. how much is that library tied to fulcro? as much as I love the concept behind pathom, I see no real advantage of fulcro over reagent+re-frame, and would rather stick to the later. the thing is that even documentation says We expect that most of our user base is made up of Om Next or Fulcro users, which makes me worry that I will be forced at some point to leak in some fulcro specific ideas into my codebase.

aisamu10:07:40

I think that refers mostly to the query "system" (now called EQL) and related concepts (idents, joins etc.)

kszabo11:07:25

On your preference to re-frame+reagent I state a new rule based on Greenspun’s tenth rule: Any sufficiently complicated re-frame program contains an ad-hoc, informally-specified, bug-ridden, slow implementation of half of Fulcro. 😂

😛 4
4
kszabo10:07:05

it is not tied at all

☝️ 4
kszabo10:07:24

there are some ns-es which require fulcro though for some convenience functions

kszabo10:07:48

while it’s a great fit for UI’s, we also use it for IPC

michal10:07:44

awesome! if so, I need definitely to give it a try.

kszabo11:07:31

and we are developing/maintaining a re-frame based Google Chrome extension

kszabo11:07:38

alongside a Fulcro SPA

wilkerlucio12:07:53

@souenzzo about the timeout, I suggest not using ::pc/key-process-timeout, this is a last resource parser stop, just for real unexpected scenarios, to do timeout you better use core.async, if you use the async parser or the parallel parser, then you can use the core.async timeout for it, example:

👍 4
wilkerlucio13:07:24

(pc/defresolver res-with-timeout [_ _]
  {::pc/output [:foo]}
  (async/go
    (let [timeout-ch (async/timeout 3000)
          [ch res] (async/alts! [(async/go
                                    (do-my-operation-here))
                                  timeout-ch] :priority true)]
      (if (= ch timeout-ch)
        (throw (ex-info "Resolver timeout" {:timeout 3000}))
        res))))

wilkerlucio13:07:31

but this is less cool way to do it, better options are implementing as a resolver-transform (https://wilkerlucio.github.io/pathom/#connect-transform) or as plugin (https://wilkerlucio.github.io/pathom/#_plugins)

wilkerlucio13:07:19

@michal as @thenonameguy said, not tied at all, it just provide extra helpers for fulcro users, but we are in the process of trying to get most of those out, with Fulcro 3 coming its been complicated to keep these references, so we want for the user to don't pull anything from fulcro unless you are actually using, so fulcro will be a provided dep probably

michal13:07:15

@wilkerlucio having dependency on fulcro as optional would be a great step forward 🙂 btw. I really enjoyed watching your presentations about pathom. very inspiring ones imho.

wilkerlucio17:07:14

it is, but you have to request the trace as part of the query

wilkerlucio17:07:08

@souenzzo add the property :com.wsscode.pathom/trace to your query

wilkerlucio17:07:35

the way I do it most of the time is wrapping the fulcro network, pathom has a helper for that: https://cljdoc.org/d/com.wsscode/pathom/2.2.17/api/com.wsscode.pathom.fulcro.network#trace-remote

👍 4
wilkerlucio17:07:24

but notice this doesn't work for Fulcro 3, in case you are already using it (the helper thing)

tony.kay01:07:17

F3 allows for a global eql transform that could handle it, bit that would affect all remotes…wrapping the new remote would also be relatively simple

souenzzo18:07:24

pfn/trace-remote works with fcn/fulcro-http-remote ?

wilkerlucio18:07:40

works with any remote from Fulcro 2

souenzzo18:07:50

I'm getting

network.cljs:118 Uncaught TypeError: Cannot read property 'cljs$core$IFn$_invoke$arity$1' of null
    at network.cljs:118
    at fulcro$client$network$progress_routine_STAR__$_progress_fn (network.cljc:287)
    at goog.net.XhrIo.<anonymous> (network.cljc:330)
    at goog.net.XhrIo.goog.events.EventTarget.fireListeners (eventtarget.js:285)
    at Function.goog.events.EventTarget.dispatchEventInternal_ (eventtarget.js:383)
    at goog.net.XhrIo.goog.events.EventTarget.dispatchEvent (eventtarget.js:196)
    at goog.net.XhrIo.onProgressHandler_ (xhrio.js:904)

souenzzo18:07:08

Full ex

Uncaught TypeError: Cannot read property 'cljs$core$IFn$_invoke$arity$1' of null
    at network.cljs:118
    at fulcro$client$network$progress_routine_STAR__$_progress_fn (network.cljc:287)
    at network.cljc:275
    at goog.net.XhrIo.<anonymous> (network.cljc:324)
    at goog.net.XhrIo.goog.events.EventTarget.fireListeners (eventtarget.js:285)
    at Function.goog.events.EventTarget.dispatchEventInternal_ (eventtarget.js:383)
    at goog.net.XhrIo.goog.events.EventTarget.dispatchEvent (eventtarget.js:196)
    at goog.net.XhrIo.onReadyStateChangeHelper_ (xhrio.js:873)
    at goog.net.XhrIo.onReadyStateChangeEntryPoint_ (xhrio.js:818)
    at goog.net.XhrIo.onReadyStateChange_ (xhrio.js:802)
(anonymous) @ network.cljs:118
fulcro$client$network$progress_routine_STAR__$_progress_fn @ network.cljc:287
(anonymous) @ network.cljc:275
(anonymous) @ network.cljc:324
goog.events.EventTarget.fireListeners @ eventtarget.js:285
goog.events.EventTarget.dispatchEventInternal_ @ eventtarget.js:383
goog.events.EventTarget.dispatchEvent @ eventtarget.js:196
goog.net.XhrIo.onReadyStateChangeHelper_ @ xhrio.js:873
goog.net.XhrIo.onReadyStateChangeEntryPoint_ @ xhrio.js:818
goog.net.XhrIo.onReadyStateChange_ @ xhrio.js:802
XMLHttpRequest.send (async)
goog.net.XhrIo.send @ xhrio.js:632
fulcro$client$network$xhrio_send @ network.cljc:30
(anonymous) @ network.cljc:334
fulcro$client$network$transmit @ network.cljc:103
(anonymous) @ network.cljs:116
fulcro$client$network$transmit @ network.cljc:103
(anonymous) @ client.cljs:187
fulcro$client$network$transmit @ network.cljc:103
fulcro$inspect$client$handle_devtool_message @ client.cljs:320
(anonymous) @ client.cljs:46
postMessage (async)
(anonymous) @ content-script.js:96

souenzzo18:07:58

occurs just when there is no p/trace-plugin on server 🙂

souenzzo18:07:06

just when I'm using 'send to query'