pathom

:pathom: https://github.com/wilkerlucio/pathom/ & https://pathom3.wsscode.com & https://roamresearch.com/#/app/wsscode
2021-01-27T05:28:33.045400Z

Hey all, trying to build pathom-viz on windows here and it looks like in order to get shadow to actually compile I had to run:

npx shadow-cljs --aliases dev:dev-ws:electron:provided release electron-background electron-renderer
this replaces the
./script/build-electron
step in the docs

wilkerlucio 2021-01-27T14:05:19.046500Z

did you tried on master? I tough I fixed that yesterday

wilkerlucio 2021-01-27T14:07:25.047700Z

but I also didnt got to test on windows, after that command it ran fine for you?

2021-01-27T14:15:15.047900Z

Yeah, I have pathom viz running

2021-01-27T14:15:41.048100Z

It seems like the exe isn't one file and you have to keep it in the build output location

2021-01-27T14:15:52.048300Z

but other than that, it seems to work

wilkerlucio 2021-01-27T14:37:22.048500Z

glad to hear, please let me know if you find any issues

2021-01-27T14:39:06.048700Z

copying from the query output seems... odd? Like I think I can paste into that field

2021-01-27T14:39:53.048900Z

and using node+async seems to cause issues with the autocomplete, all my resolvers don't show up in autocomplete, and the trace seems incomplete an ungraphed

2021-01-27T14:40:16.049100Z

And those resolvers do show up in indexes

2021-01-27T14:40:34.049300Z

I am not sure its my graph being poorly built or if it is something with pathom viz

2021-01-27T14:41:17.049500Z

Also if I toss a query that is malformed or impossible I lock up the UI

wilkerlucio 2021-01-27T14:45:43.049700Z

resolvers don't show auto-complete, just the attributes

wilkerlucio 2021-01-27T14:45:58.049900Z

async should be ok, Pathom 2 or 3?

wilkerlucio 2021-01-27T14:46:23.050100Z

(also, attributes are contextual, the options depend on your query path)

2021-01-27T14:57:49.050300Z

pathom3

2021-01-27T14:58:12.050500Z

and to be fair, I am just assuming async is the problem which, on reflection, probably doesn't make a lot of sense

2021-01-27T15:02:22.050700Z

re the resolver and attributes comment, I meant the attributes that I have added via resolvers

2021-01-27T15:02:38.050900Z

pathom's built-in's seem to show up

wilkerlucio 2021-01-27T15:41:12.051100Z

probably a dependency thing

wilkerlucio 2021-01-27T15:41:20.051300Z

at root you only see what is globaly available

wilkerlucio 2021-01-27T15:41:37.051500Z

but if you start a query, let's say: [{[:user/id 123] [CURSOR_HERE]}]

wilkerlucio 2021-01-27T15:41:45.051700Z

at that point, it should show up things that are reachable from a :user/id

wilkerlucio 2021-01-27T15:43:59.051900Z

support for data from Placeholders is coming soon

2021-01-27T15:46:05.052100Z

Ahh problem seems to be that I rely on two inputs to my resolver

wilkerlucio 2021-01-27T15:57:15.052300Z

if you have some entry point that provides both, them you can see auto-complete for it

2021-01-27T16:30:51.053500Z

hey everyone, what’s the preferred way to inject query data that’s already been resolved in a parent/sibling key into a child query input? attempting to put the relevant key on my input declaration doesn’t seem to be working

2021-01-27T16:36:33.055300Z

I figured it would be possible to do something like ::pathom-connect/input #{:user/email :other-thing/id} but that doesn’t seem to be the case

wilkerlucio 2021-01-27T16:41:07.056Z

@mss if I get right, what you need is to place the data in the output of the parent, so it will be available for children

wilkerlucio 2021-01-27T16:41:33.056600Z

the input is a declaration of requirement, the data needs to come from somewhere, can you give a small example of what you are trying to do?

2021-01-27T16:45:21.060Z

yeah so I have a fulcro load! call on app startup that’s parameterized by :user/email like so:

(df/load! mounted-app
 [:user/email user-email]
 User...)
that load! hits a series of resolvers that pull user app state. a user has projects, which have goals, which have tasks. within the the resolver for a task, I want to be able to utilize that :user/email key that’s theoretically already resolved by the input entity to pull some state within the resolver. for whatever reason, declaring a resolver with input of #{:user/email :task/id} doesn’t seem to be getting triggered. I’m sure I’m missing something simple here, just not sure what

wilkerlucio 2021-01-27T17:05:22.060300Z

this a good time to debug just your parser, use the REPL and make calls direclty to it, use * on the query to see all the data available at that point

wilkerlucio 2021-01-27T17:05:29.060500Z

this way I usually can spot where the data is missing

2021-01-27T17:07:01.062300Z

@wilkerlucio having several problem with the new pathom-viz app, it’s constantly locking. couldnt’ really see anytyhing in the console log. how can i debug it? i noticed that everytime i paste something app blocks, this is not the only case though.

wilkerlucio 2021-01-27T17:07:53.062600Z

you can open the devtools with cmd + opt + i (on mac). or ctrl + alt +i on others

wilkerlucio 2021-01-27T17:07:56.062800Z

what OS are you in?

wilkerlucio 2021-01-27T17:08:14.063Z

and you mean pasting at the query editor?

2021-01-27T17:08:54.063200Z

mac (bigsur), dont’ really see anything on the devtool, it just freezes when writing the query

2021-01-27T17:11:10.063500Z

yes, pasting at the query editor. but it’s freezing also when comlpeting a query with an input. example, i am trying to type this

[{[:edge.calendar/code "{{code}}"] [:edge.calendar/name :edge.calendar/code   :edge.calendar/calendarid  :edge.calendar/creation-date :edge.calendar/expired
                                                                    :edge.calendar/status :edge.calendar/workdays  :edge.calendar/weekend
                                                                    {:edge.calendar/events [:edge.calendar.event/day :edge.calendar.event/type :edge.calendar.event/label]}]}]
so when i get here it freezes.
[{[:edge.calendar/code "acode"] []}] 

2021-01-27T17:11:32.063900Z

this is against a pathom2 engine

2021-01-27T17:16:18.064300Z

saw this is in the console when connecting to the remote

main.js:2441 POST <http://localhost:3000/pathom> 500 (Internal Server Error)
h	@	main.js:2441
l	@	main.js:2442
$APP.cljs.core.async.impl.ioc_helpers.run_state_machine	@	shared.js:7233
$APP.cljs.core.async.impl.ioc_helpers.run_state_machine_wrapped	@	shared.js:7234
(anonymous)	@	main.js:2443
$APP.cljs.core.async.impl.dispatch.process_messages	@	shared.js:7166
processImmediate	@	internal/timers.js:439

2021-01-27T17:17:43.064500Z

no error when the app freezes, just when connecting to the remote

wilkerlucio 2021-01-27T17:19:35.064700Z

the engine shouldn't matter because the calculations happen inside the app for auto-complete

wilkerlucio 2021-01-27T17:19:59.064900Z

I didn't upgraded to Bigsur, but I heard about some general complaints on performance, I wonder if the version of Electron (which is not very recent) is getting affected by it

2021-01-27T17:20:50.065200Z

might be, i didn’t use pathomviz since upgrading to big sure, let me check if the older version of PathomViz has the same issue

wilkerlucio 2021-01-27T17:21:22.065400Z

cool, thanks for checking, curious to learn of your findings

2021-01-27T17:22:33.065600Z

no problem with 1.1.1

2021-01-27T17:22:51.065800Z

pasting works, query i was trying to enter works fine

2021-01-27T17:24:06.066Z

so i think something it’s going on with the latest version. i am happy to help test it, not sure how though :/

wilkerlucio 2021-01-27T17:26:27.066200Z

is it a big index? I did changed the auto-complete algorithm, but I personally only tested on small things, it can it

2021-01-27T17:27:08.066400Z

no, it’s not big at all

wilkerlucio 2021-01-27T17:29:08.066600Z

if you have some time to help with debug, you can build the app locally, and try there, using the performance tools from Chrome, in the dev app you will be able to see the names of the functions

wilkerlucio 2021-01-27T17:29:16.066800Z

have you used the performance tab from Chrome before?

wilkerlucio 2021-01-27T17:30:26.067Z

(and just to give you context, even if the algorithm was slower, there is a bunch of caches, so it should be slow only for the first letter, after that its the same, so I wonder if the cache is misconfigured)

wilkerlucio 2021-01-27T17:30:35.067200Z

or maybe its something else entirely

2021-01-27T17:33:39.067400Z

could it be the cache from the prev version interfering with the latest? ill remove it and try again

wilkerlucio 2021-01-27T17:35:16.067600Z

no, this cache is memory only

2021-01-27T17:36:55.067800Z

ok, will check the performance tab and send you my findings.

2021-01-27T17:44:01.068Z

this a screenscast with the issue

wilkerlucio 2021-01-27T17:46:07.068400Z

yeah, and the view is strange too, it shouldn't be black on the right side

wilkerlucio 2021-01-27T17:46:23.068600Z

how is the style after you run a query?

2021-01-27T17:46:57.068900Z

the black is the console

wilkerlucio 2021-01-27T17:47:15.069100Z

before that, the query results pane part

2021-01-27T17:47:16.069300Z

(dark theme)

2021-01-27T17:47:29.069500Z

ohh right

wilkerlucio 2021-01-27T17:47:41.069700Z

for comparison here

wilkerlucio 2021-01-27T17:47:55.070100Z

dark theme shouldn't affect it (unless there is something I dont know about Codemirror6 and Bigsur :P)

souenzzo 2021-01-27T18:04:01.070400Z

@mss in pathom3, placeholders do that https://pathom3.wsscode.com/docs/placeholders in pathom2, you can use :pathom/context special params Your query should look like that:

[{([:user/email "abc"] {:pathom/context {:other-thing/id 42}})
  [:user/something]}]

2021-01-27T20:23:55.070800Z

@wilkerlucio what specifically would I be looking for? my query is calling the correct resolver unless I put in the key :user/email in the input set like so:

{::pathom-connect/input  #{:user/email :task/id}
   ::pathom-connect/output [:task/title
                            :task/description]}
the parent/sibling resolvers are getting correctly invoked given an input set of #{:user/email}. not quite sure how to debug that at the repl

2021-01-27T20:28:38.071100Z

I would think that since :user/email is both a key satisfied by a query parameter/ident and returned into the response map at my top level user resolver that it would be available as an input key to child resolvers

2021-01-27T20:30:11.071300Z

FWIW my query looks something like this:

[{[:user/email "<mailto:testuser@test.com|testuser@test.com>"]
  [:user/first-name 
   :user/last-name 
   :user/email
   {:user/projects
    [{:project/goals
      [:goal/id
       {:goal/tasks
        [:task/id
         :task/status]}]}]}]}]
and my top level user resolver looks roughly like this:
(pathom-connect/defresolver user [env params]
  {::pathom-connect/input  #{:user/email}
   ::pathom-connect/output [:user/first-name
                            :user/last-name
                            :user/email]}
  {:user/first-name user-first-name
   :user/last-name  user-last-name
   :user/email (:user/email params)})

2021-01-27T20:36:20.071600Z

I would have expected that :user/email would then be available in child resolvers

wilkerlucio 2021-01-27T21:42:47.072800Z

the ident only provides data to the first child level of it, after that each context has only the data provided for it

wilkerlucio 2021-01-27T21:43:11.073700Z

you can flow the data down manually if you want, but seems too many levels for me

wilkerlucio 2021-01-27T21:43:45.074800Z

another option is have a path to fetch the user id from the task id (if it has a reference to one)

2021-01-27T22:31:59.076800Z

What would a path to fetch the user id look like? Something out of band? My initial way of solving this was to reach for storing global data like that in the request and throwing it into the parse env. Is that the best way to go about that?

2021-01-27T22:35:30.077Z

yeah unfortunately within the task resolver there’s no context around what user id exists. I tried to assoc the user/email into the env within the user resolver, but that didn’t seem to work

wilkerlucio 2021-01-27T22:40:19.077200Z

it depends on how you data is organized, does your db row/entity for task knows about the user related to it?

wilkerlucio 2021-01-27T22:40:26.077400Z

does it have a reference to it?

wilkerlucio 2021-01-27T22:40:56.077600Z

a path is just a resolver that gets :task/id and outputs :user/id, pulling that relationship from your database

wilkerlucio 2021-01-27T22:41:18.077800Z

but this also depends if your data model a task has a single ID, or if its something else

2021-01-27T23:17:50.079Z

The task knows nothing about the user, unfortunately. It’s currently designed as a one way relationship from users to projects to goals to tasks

wilkerlucio 2021-01-27T23:26:16.079200Z

in this case I suggest you do the manual forward down of the user id

wilkerlucio 2021-01-27T23:26:45.079400Z

for example, in the reoslver for :user/projects, in each item you add the :user/id you got on that resolver input

wilkerlucio 2021-01-27T23:27:02.079600Z

then you do the same for :project/goals, then same for :goal/tasks, makes sense?

2021-01-27T23:53:21.081100Z

Yep, absolutely. Really appreciate the insight here. And thank you for all the work you’ve done w pathom — it’s phenomenal software

❤️ 1