Fork me on GitHub
#pathom
<
2024-01-05
>
tcrawley21:01:33

Howdy! I'm trying to use placeholders, but can't get them to work. I've tried the example from https://pathom3.wsscode.com/docs/placeholders, but it isn't working either. I'm not sure if I'm doing something wrong, or this is just broken (this is with com.wsscode/pathom3 {:mvn/version "2023.08.22-alpha"}

(pco/defresolver full-name [{::keys [first-name last-name]}]
  {::full-name (str first-name " " last-name)})

(def env (pci/register full-name))

(p.eql/process env
  [{'(:>/bret {::first-name "Bret" ::last-name "Victor"})
    [::full-name]}])
Results in:
Pathom can't find a path for the following elements in the query:
   [:pathom-playground/full-name] at path [:>/bret]
   {:com.wsscode.pathom3.connect.planner/graph
    #:com.wsscode.pathom3.connect.planner{:nodes {},
                                          :index-ast
                                          #:pathom-playground{:full-name
                                                              {:type :prop,
                                                               :dispatch-key
                                                               :pathom-playground/full-name,
                                                               :key
                                                               :pathom-playground/full-name}},
                                          :source-ast
                                          {:type :join,
                                           :dispatch-key :>/bret,
                                           :key :>/bret,
                                           :params
                                           #:pathom-playground{:first-name "Bret",
                                                               :last-name
                                                               "Victor"},
                                           :meta {:line 44, :column 6},
                                           :query [:pathom-playground/full-name],
                                           :children
                                           [{:type :prop,
                                             :dispatch-key
                                             :pathom-playground/full-name,
                                             :key :pathom-playground/full-name}]},
                                          :available-data {},
                                          :user-request-shape
                                          #:pathom-playground{:full-name {}},
                                          :unreachable-paths
                                          #:pathom-playground{:full-name {},
                                                              :first-name {}}},
    :com.wsscode.pathom3.connect.planner/unreachable-paths
    #:pathom-playground{:full-name {}},
    :com.wsscode.pathom3.path/path [:>/bret],
    :com.wsscode.pathom3.error/phase :com.wsscode.pathom3.connect.planner/plan,
    :com.wsscode.pathom3.error/cause
    :com.wsscode.pathom3.error/attribute-unreachable}
I have to step away for the day, so no rush in getting back to me!

caleb.macdonaldblack22:01:29

Might be related to this breaking change: https://github.com/wilkerlucio/pathom3/pull/188 I’m not certain though. I just recall a breaking change with placeholders a while back

tcrawley13:01:13

Thanks @U3XCG2GBZ! That is what I needed; I just needed to add the placeholder plugin:

(def env (p.plugin/register
          (pci/register full-name)
          (pbip/placeholder-data-params)))
I think the docs just need to be updated.

wilkerlucio01:01:04

thanks folks, I've updated the docs to reflect the change: https://pathom3.wsscode.com/docs/placeholders/#provide-data