fulcro

Book: http://book.fulcrologic.com, Community Resources: https://fulcro-community.github.io/, RAD book at http://book.fulcrologic.com/RAD.html
aratare 2020-10-05T09:45:41.124500Z

hey there, is there another way to add no-value attributes (like disabled) to HTML tags aside from (dom/div {:disabled ""} ...)? I combed through the book and this seems to be the only way to do so, but honestly it looks kinda… weird so is there a more elegant way to do it?

Björn Ebbinghaus 2020-10-05T11:55:07.126Z

Use: {:disabled true}

exit2 2020-10-05T16:19:08.128100Z

This might be more of a pathom question, but is the typical way of setting up a resolver where you might not know all the outputs from the api response something like:

exit2 2020-10-05T16:19:15.128300Z

(pc/defresolver some-resolver
                [__ {:keys [resource/id]}]
                {::pc/input #{:resource/id}
                 ::pc/output [:id]}
                (let [resource (get-resource-by-id id)]
                  resource))

exit2 2020-10-05T16:19:36.128900Z

where I could still query other parts of the response like: [{[:resource/id 1] [:id :name]}]

exit2 2020-10-05T16:19:45.129200Z

but I wouldn’t get the auto-complete in the fulcro inspect

currentoor 2020-10-05T16:36:30.129700Z

@njustice definitely a pathom question, they have a separate channel :simple_smile:

👍 1
currentoor 2020-10-05T16:37:01.130500Z

anyway, no, the output needs to include :name

currentoor 2020-10-05T16:37:14.130800Z

if you want to be able to query for :name

exit2 2020-10-05T16:38:06.131500Z

hmm.. odd with what I have above I query any keyword in the response of resource

exit2 2020-10-05T16:38:31.132Z

my example query works, and returns {[:resource/id 1] {:name "foo", :id 1}}

exit2 2020-10-05T16:38:43.132300Z

(at least it works in fc inspect query)

currentoor 2020-10-05T16:39:52.133400Z

hmm, might be a feature of a newer version? or i'm misremembering

exit2 2020-10-05T16:40:19.133600Z

it would be tricky for me to know all the properties the api will respond with, I.e. a new field is added to the response

exit2 2020-10-05T16:41:07.134400Z

I recalled Tony saying something (in the videos) about how ::pc/output helps w/ auto-complete but you can query other fields - but I could also be misremembering

currentoor 2020-10-05T16:41:55.134700Z

totally could be correct 😅

exit2 2020-10-05T16:42:32.135Z

haha let me see if I can find the part in the videos 😄

tvaughan 2020-10-05T18:17:59.135100Z

Our resolver returns :stuff (not the actual name) which is a hash-map of all the stuff we're not sure will be returned and which we have little control over (just enough control to coerce everything under the stuff keyword)

zilti 2020-10-05T20:14:32.136400Z

Hmm, did something change/break with Fulcro and/or the Inspect tool? The tool loads an initial state, but then is "stuck" on it. Even a tab refresh doesn't un-stuck it. Meanwhile, I get about two dozen copies of this error in the console:

Jakub Holý 2020-10-05T20:19:50.136700Z

Do you get the warnings logged also in a browser without Inspect, eg Firefox?

zilti 2020-10-05T20:22:21.137600Z

Good point. I just checked, and yes I do. Although only four times.

exit2 2020-10-05T20:23:18.138500Z

When developing locally for a full stack application, how do we tell the client the location of the server? POST <http://localhost:8000/api> 404 (Not Found)

exit2 2020-10-05T20:44:55.139Z

Are we not to develop from 8000 and have it hit 3000/api?

zilti 2020-10-05T21:18:43.139400Z

The /api is under the same host as the page itself, so it is also on port 3000. The other ports are for shadow-cljs and the nrepl.

tony.kay 2020-10-05T21:32:34.139600Z

@zilti versions?

tony.kay 2020-10-05T21:32:48.139800Z

Latest Fulcro requires manual update to inspect at the moment

tony.kay 2020-10-05T21:32:54.140Z

I’ve been messaging about it all week

exit2 2020-10-05T21:34:25.140200Z

Ok, so deving from 3000 make sense. But why do I get this error when trying to go to a page that fetches data from the API?

exit2 2020-10-05T21:34:46.140900Z

core.cljs:159 WARN [com.fulcrologic.fulcro.networking.http-remote:184] - Transit decode failed!

exit2 2020-10-05T21:34:52.141100Z

core.cljs:159 ERROR [com.fulcrologic.fulcro.networking.http-remote:344] - 
#error {:message "Remote Error"

tony.kay 2020-10-05T21:34:57.141300Z

output is used to build indexes in Pathom, so autocomplete won’t work without that info. You can return stuff from a resolver that isn’t advertised, but treat that as an optimization since pathom itself would not know to ask for it from that source. For example, say you have a resolver for fact A that can be retrieved via some ID, but another route can also give A if it is hit. If that route does not advertise it can return A then it will never be asked for A; however, if it is hit first and provides A anyway, then Pathom will detect that is already has A and won’t go looking to resolve it if it then finds that it needs it.

exit2 2020-10-05T21:35:23.141500Z

strangely enough, I can go to the server localhost:3000/index.html and navigate to that page via a link and the page loads, data renders..

zilti 2020-10-05T21:35:31.141700Z

3.4.1 currently. Ah, I'll try that then!

tony.kay 2020-10-05T21:35:52.141900Z

See https://github.com/fulcrologic/fulcro-inspect/releases

tony.kay 2020-10-05T21:36:16.142100Z

yes, 3.4.1 will NOT work with the Chrome store version of Inspect

tony.kay 2020-10-05T21:36:57.142900Z

I’ll restate it in case anyone missed it: The current Chrome Store release of Inspect will not work with Fulcro 3.4+. There are pre-release versions of the new Inspect that you can manually install here: https://github.com/fulcrologic/fulcro-inspect/releases

tony.kay 2020-10-05T21:37:07.143100Z

both Chrome and Electron

zilti 2020-10-05T21:38:22.143200Z

Hmm it still doesn't work though. Same errors in console, same behaviour

tony.kay 2020-10-05T21:42:49.143400Z

I would recommend using the latest Inspect (which requires 3.4.3-SNAPSHOT of Fulcro). They depend on each other.

tony.kay 2020-10-05T21:43:52.143600Z

it definitely works for me, so you’ll have to provide much more context if you want further help: OS Versions involved Errors from your console Errors from Inspect’s console (right click on Fulcro Inspect and choose Inspect)

tony.kay 2020-10-05T21:44:03.143800Z

screen shot of UI of Inspect

zilti 2020-10-05T21:44:29.144Z

Well, since I also get the same errors in Firefox without Inspect, I am not even sure if Inspect is the cause

zilti 2020-10-05T21:46:01.144200Z

Okay, latest Inspect, Fulcro 3.4.3-SNAPSHOT. Console errors: see screenshot above. Errors from Inspect's console: none.

tony.kay 2020-10-05T21:50:18.144400Z

the console errors you’re showing me have to do with your routing and application startup mistakes (they are harmless, though), nothing to do with inspect.

tony.kay 2020-10-05T21:50:58.144700Z

all that’s happening there is you’re rendering routers before you’ve started them.

tony.kay 2020-10-05T21:51:39.144900Z

(which is harmless, but deserves a warning because that could be a problem in non-startup scenarios)

tony.kay 2020-10-05T21:52:40.145100Z

I’d recommend quitting/restarting Chrome. You must at least start a new tab to get a newly installed inspect.

tony.kay 2020-10-05T21:52:50.145300Z

and make sure you uninstalled the old one

zilti 2020-10-05T21:54:43.145500Z

Hmm, quitting/restarting Chrome helped. Also, good to know where the warnings are from (a bit odd though that they get repeated so many times). As always, thank you a lot!

tony.kay 2020-10-05T23:39:38.146Z

sure. In terms of repeating: yeah, they will repeat on every render until the SM starts, so that really depends on how many animation frames you cause before a route gets triggered to start the SM. You can use app/set-root! with initialize state, then dr/initialize! or dr/change-route!, then app/mount! with NO initialize state to get rid of most or all of those. Basically: Make sure you’ve explicitly routed to a leaf (target) before mounting.

tony.kay 2020-10-05T23:40:00.146200Z

(initialize just makes sure all routers have started their state machiens)