Fork me on GitHub
#pathom
<
2019-10-31
>
eoliphant00:10:03

did some more digging, looks like it might be the datomic connect plugin. Took it out, it worked fine started adding it back in

java.lang.RuntimeException: java.lang.Exception: Not supported: class com.wsscode.pathom.connect.datomic$index_schema$fn__34159
	at com.cognitect.transit.impl.WriterFactory$1.write(WriterFactory.java:65)

souenzzo03:10:27

(pc/defresolver index-explorer [{::pc/keys [indexes]} _]
                {::pc/input  #{:com.wsscode.pathom.viz.index-explorer/id}
                 ::pc/output [:com.wsscode.pathom.viz.index-explorer/index]}
  {:com.wsscode.pathom.viz.index-explorer/index (p/transduce-maps
                                                  (remove (comp #{::pc/resolve ::pc/mutate}
                                                                key))
                                                  indexes)})

I use this resolver

henrik09:10:20

FWIW, I’m not getting indices either. Q:

[{[:com.wsscode.pathom.viz.index-explorer/id
   [:fulcro.inspect.core/app-uuid
    #uuid "85b4ac42-f4bb-48b8-92bb-b9c3a769d843"
    :remote]]
  [:com.wsscode.pathom.viz.index-explorer/id
   :com.wsscode.pathom.viz.index-explorer/index]}]
A:
{[:com.wsscode.pathom.viz.index-explorer/id
  [:fulcro.inspect.core/app-uuid
   #uuid "85b4ac42-f4bb-48b8-92bb-b9c3a769d843"
   :remote]]
 {:ui/fetch-state {:fulcro.client.impl.data-fetch/type :not-found}}}

henrik09:10:52

This is with the above index resolver.

eoliphant01:10:55

so after creating the writer

eoliphant01:10:15

does it need to be jacked into the parser config?

wilkerlucio02:10:18

this has nothing to do with pathom really, its a issue when you try to send things over transit that are not encodable by default (like fns)

wilkerlucio02:10:40

my tutorial is to add a default handler so you just send a bogus data, but doens't break the encoding

👍 4
henrik11:10:51

Is there any way to…

;; Transform…
{:a {:b [d1 d2 d3 … dn]
     :c [d1 d2 d3 … dn]}}

;; Into…
{:a {:b {:>/group [d1 d2 d3 … dn]}
     :c {:>/group [d1 d2 d3 … dn]}}}
… using placeholders?

wilkerlucio14:10:07

@henrik I don't understand what you are trying to do, can you tell more about your use case?

henrik14:10:04

Sure, :b and :c (and more) return children on the exact same format. There has to be a group component between :a and the ds (I can’t render them directly in the component that has a as query). I could make different components for b and c etc., but that would be redundant. The other alternative is to destructure both b and c in a unified group component, then (or b c) to render the children. Alternatively, destructure :b and :c in a, then send the children as props to the group component (which feels a bit funky, I’m conditioned to want props to be a map). Or, I effectively rename :b and :c to something unified that the group component will understand, for which one alternative might be to scope the ds under some well known key.

henrik14:10:00

I’m dealing with a deep map with no natural idents as far as the eye can see.

henrik15:10:08

;; Data
{:a {:b [d1 d2 d3 … dn]
     :c [d1 d2 d3 … dn]}}

;; One component for `a`, one for the `b`/`c` level, one for each `d`

;; Alternative 1
(defsc ComponentForA [this {:keys [b c]}]
  (ui-group-comp b)
  (ui-group-comp c))

(defsc GroupCompForBorC [this props]
  ;; Props will be a vector
  (map ui-d-comp props)) 


;; Alternative 2
(defsc ComponentForA [this {:a/keys [b c] :as props}]
  (ui-group-comp (select-keys props [b]))
  (ui-group-comp (select-keys props [c])))

(defsc GroupCompForBorC [this {:keys [b c]}]
  ;; Props will be a  map of either 
  ;; {:b […]} or {:c […]}
  (map ui-d-comp (or b c)))


;; Ideally
(defsc ComponentForA [this props]
  ??)

(defsc GroupComp [this {:keys [group-of-ds]}]
  (map ui-d-comp group-of-ds))

henrik16:10:51

Forget all of the above, it turns out I’m trying to optimize for a pointless scenario.

wilkerlucio17:10:13

@henrik glad you reach a point, IME is always good to have some ident to any thing you reference, I did bit myself multiple times when I decided to not have one

henrik17:10:37

It’s not really up to me to decide I’m afraid, I have to work with the data as returned by the API 🙂 There are no idents, so I can’t pretend like there are.

henrik17:10:14

Essentially, it’s

{:search-filters 
 {:categories [{:title "Biology"
                :count 3214}
               {:title "Chemistry"
                :count 89}
               …]
  :publishers [{:title "Springer"
                :count 212}
               …]
  :journals [{:title "Nature"
              :count 2131}]}}

henrik17:10:34

But with a more complicated naming structure. Not much in there to grab onto as an ident.

wilkerlucio17:10:53

yeah, that always sucks... (when you can't control it, but must use it)