Fork me on GitHub
#pathom
<
2019-07-22
>
jose13:07:58

the problem was that I was still using the pp/profile-plugin instead of the new p/trace-plugin, now all works in the card, but I'm still having problems rendering the editor as a standalone app, I tried to adapt the example in the docs ( https://wilkerlucio.github.io/pathom/#_stand_alone_app ):

(fp/defsc Root
  [this {:keys [ui/root]}]
  {:query [{:ui/root (fp/get-query pv.query-editor/QueryEditor)}]}
  (pv.query-editor/query-editor root))

(def root (fp/factory Root))

(defn ^:export init []
  (let [app (fc/make-fulcro-client
              {:client-did-mount
               (fn [app]
                 (df/load app [::pv.query-editor/id "singleton"] pv.query-editor/QueryEditor
                   {:target [:ui/root]}))
               :networking
               {pv.query-editor/remote-key
                (p.network/pathom-remote
                  (pv.query-editor/client-card-parser (http-request-parser "")))}})]
    (fc/mount app Root (js/document.getElementById "app"))))
but I guess I'm missing something, since I get multiple warnings and error on the js console

wilkerlucio13:07:48

@jlle any reason for not switching to trace? and errors are you seeing?

jose14:07:31

I switched to trace, that fixed the problems with the card

jose14:07:31

I got this warning: [fulcro.client.primitives] component com.wsscode.pathom.viz.query-editor/QueryEditor's ident ([:com.wsscode.pathom.viz.query-editor/id nil]) has a 'nil' second element. This warning can be safely ignored if that is intended.

jose14:07:00

and this error when I try to execute a query: [fulcro.client.impl.application] Use of invalid remote(s) detected! #{:remote}

jose14:07:43

also, the layout seems broken, not as beautiful as the card, and I get an CodeMirror error: Error setting up CodeMirror TypeError: Cannot read property 'split' of null

wilkerlucio14:07:30

@jlle for the layout I guess you will have to upsert the css, check fulcro docs on how to do it

wilkerlucio14:07:52

and for the load, I see you need a change there, you need to point to the correct remote, add :remote pv.query-editor/remote-key to do map in the load call

wilkerlucio14:07:14

actually, maybe you don't need this load at all

jose15:07:57

thanks, I managed to upsert the css, now looks better. But I guess that the component is not properly initialized, apart of the errors I posted, I noticed that the :initial-state is not applied (e.g.: Request trace checkbox should be enabled, but is not )

jose16:07:36

I think this error is related, if I click on 'Refresh index` I get Uncaught Error: Assert failed: (or (util/ident? server-property-or-ident) (keyword? server-property-or-ident))

wilkerlucio16:07:04

humm, do you have fulcro inspect? not sure if you are familiar with fulcro apps, but inspecting the DB can be helpful to find were the data link is broken

wilkerlucio16:07:09

about the initial load, if you want to load the index at start, instead of doing a manual call you can call this fn: https://github.com/wilkerlucio/pathom-viz/blob/master/src/core/com/wsscode/pathom/viz/query_editor.cljs#L65-L71

jose20:07:52

@wilkerlucio thanks again, fulcro inspect helped me. I think that finally I got the query editor properly working as a stand alone app 🙂 Would you be interested in a PR to pathom-viz to add a build for the standalone app?

👍 8
wilkerlucio20:07:41

I'm also planning on adding new docs soon for Pathom Viz, following the format in http://edn-query-language.org

wilkerlucio20:07:59

so we could have a proper tutorial there, if you like to write something in asciidoc format would be great!

jose20:07:11

sure, I want to test what I have and do some clean up and I will do a PR