Fork me on GitHub
#pathom
<
2019-04-03
>
wilkerlucio00:04:20

hello @mail228, welcome, most of what you need should be present in the pathom documentation, did you give it a try? for the parser, there is not a lot special about the storages you mentioned, if you use local storage its simpler because its sync, but pathom also supports async so its also fine if you wanna use indexeddb or something like it

mail22806:04:58

@wilkerlucio Thanks, I skimmed the Connect chapter (3) and I think I got the parser up and running. I could make queries and have them resolve correctly. The problem I can't figure is how to keep Pathom resolvers and parser local and have Fulcro use that for querying. The template generates a server (which makes sense for most cases), but I haven't been able to it just client-side

mail22810:04:04

Thanks, this seems to use a server for storing data, right? I need to just have everything on the client, in theory only have .cljs files in the project, since there is no /api endpoint to call

wilkerlucio12:04:41

@mail228 I'm lacking a proper example for simple setup, but you can piggieback on this one: https://wilkerlucio.github.io/pathom/#_complete_graphql_connect_example

wilkerlucio12:04:05

this is a graphql connect setup on client only, just remove the graphql parts and it should work, please let me know if that is enough to get a setup

mroerni12:04:45

@mail228 As I understand pathom, this ist fairly simple. You could nearly use my serversite code... and create a pathom-remote for fulcro https://github.com/hhucn/decidotron/blob/master/src/main/decidotron/remotes/dbas.cljs#L47 (the functions prefixed with dbas/ are actually returning core.async channels) and https://github.com/hhucn/decidotron/blob/master/src/main/decidotron/client.cljs#L68

mail22812:04:38

Thanks @wilkerlucio I will try it out when I get back from work 🙂

mail22812:04:52

@ Interesting, what does :dbas mean? I don't see it mentioned in the Pathom guide

mroerni12:04:22

It is my own namespace. Has nothing to do with pathom

mail22812:04:47

Ah, is that a replacement for remote? I see you use (dbas in defmutation

wilkerlucio12:04:16

just like bjorn did as well, you create a pathom parser and use it as a fulcro remote

mail22812:04:05

So to understand, the name I give here https://github.com/hhucn/decidotron/blob/de7c9a11f035fe085049f55d5581424e0ef8a919/src/main/decidotron/client.cljs#L68 in this case :dbas is then available as (dbas in defmutation?

mail22812:04:56

Then Fulcro understands this is possible to query and gets its data from that?

mroerni12:04:45

:dbas is the name of the remote, yes

mroerni12:04:38

https://github.com/hhucn/decidotron/blob/de7c9a11f035fe085049f55d5581424e0ef8a919/src/main/decidotron/ui/components/login.cljs#L60 Here is the only place I use the dbas remote nowadays. (I don't use the remote, because I had to ditch a feature)

mail22812:04:37

Okay, I think it's clicking now!

mail22812:04:45

I start to see how it works

mail22812:04:59

Thanks so much both, I look forward to try later when I get home 🙂

wilkerlucio12:04:24

you can also just use as a default remote, this way you don't have to specificy the remote name on the load calls

wilkerlucio12:04:49

I usually give custom names only for extensions (when its something not related to the main app, or some special kinds of remotes like ones targetted for uploads, etc...)

mail22812:04:19

How do I specify a default remote?

wilkerlucio12:04:14

in the code example I sent to you on graphql there is the full setup, basically just set as :networking (pathom-remote ...) or :networking {:remote (pathom-remote ...)}

wilkerlucio12:04:25

on the fulcro side

mail22812:04:47

Ah so :remote is the default name?

mroerni12:04:42

Yes, from the docs

`:networking` (optional). An instance of FulcroNetwork that will act as the default remote (named :remote). If
  you want to support multiple remotes, then this should be a map whose keys are the keyword names of the remotes
  and whose values are FulcroNetwork instances.

mail22812:04:29

@ How did you find that 🤔 I went here https://github.com/fulcrologic/fulcro clicked cljdoc, end up here https://cljdoc.org/d/fulcrologic/fulcro/2.8.8/doc/readme but I see no API docs. It does work on 2.8.0 though https://cljdoc.org/d/fulcrologic/fulcro/2.8.0/doc/readme

mroerni12:04:13

It is in the docstring of the make-fulcro-client funktion.

mail22812:04:27

Ah makes sense, didn't think of checking source code, thanks 🙂 I'll notify in #fulcro that namespaces docs are missing

mail22815:04:47

Looks like it works, I can at least query from Fulcro Inspect, thanks for your patience @ @wilkerlucio

mroerni15:04:00

You are welcome

mroerni15:04:18

Don't forget to make use of the autocompletion feature. Click the grey circle in the top right corner of the query screen. I found it way too late.

mail22815:04:36

ohhh that's what it do lol I clicked it before I got it working and didn't understand

wilkerlucio16:04:00

if you change the index (add resolvers/mutations) remember to click again on the ball to refresh it

thheller21:04:21

what is the state of the non-parallel parser? I'm trying to use it but somehow it works differently than the parallel one although I'm not doing anything async

thheller21:04:43

the example doesn't in the readme doesn't seem to work for example

wilkerlucio22:04:58

@thheller using the non-parallel parser requires you to use different readers

wilkerlucio22:04:09

I suggest pc/reader2 instead of pc/parallel-reader, also need to use the regular mutate

wilkerlucio22:04:15

@thheller try checking the example code right above this anchor, that should be a regular sync functional setup, please let me know if you find issues with it https://wilkerlucio.github.io/pathom/#_parallel_parser

thheller22:04:31

ah I just commented out the parallel-reader

wilkerlucio22:04:15

but that's the reader that does all the connect things, you may need it 🙂

wilkerlucio22:04:23

but use reader2 instead for the sync parser

thheller22:04:09

ok thx, that works

wilkerlucio22:04:53

in which part of the doc you tried to look for this information? so I may add it there, or a link or something

thheller22:04:36

all the examples used the parallel-parser so I thought the sync parser was maybe deprecated or so