fulcro

Book: http://book.fulcrologic.com, Community Resources: https://fulcro-community.github.io/, RAD book at http://book.fulcrologic.com/RAD.html
Aleksander Rendtslev 2020-12-13T01:04:58.340700Z

I’m still working through this and trying to understand why it isn’t working. Currently reading through the book, so I’ll keep going until I find the answer. However, I would have expected it to be in the section in the screenshot below (or here: https://book.fulcrologic.com/#_mutations_on_a_normalized_database). I just learned how to delete an entity from a list (meaning updating that view in the graph). How do I add to it?? I suppose I’ll just read on. It would have been neat with either an explicit example, or: For appending or prepending an element to a list you would do this: … Or read more about how to control the elements of lists here (link to the section) I know now that it’s just a node in the database, but for some reason I still can’t figure out how to update it correctly and get it to propagate on my screen

tony.kay 2020-12-13T01:28:33.341100Z

You need to enable custom formatters

tony.kay 2020-12-13T01:29:20.341300Z

they the error message would have been more understandable because it would have shown you the attribute details

tony.kay 2020-12-13T01:29:46.341500Z

And yeah, there is no UUID form control…you’d have to make one, but that’s easy enough

Aleksander Rendtslev 2020-12-13T01:33:18.341700Z

Ok, I’m clueless about this one. Probably just a gotcha I can’t figure out, but if any of you can see what I’m doing wrong here, that would be super helpful:

Aleksander Rendtslev 2020-12-13T01:34:16.341900Z

Aleksander Rendtslev 2020-12-13T01:34:46.342300Z

Aleksander Rendtslev 2020-12-13T01:36:21.342700Z

1. Everything works fine for EntryOverlay. It receives the added entry annd the cursor-pos changes to 9000 (I’m printing it on the screen to check it out) 2. Nothing changes for the EntryList. Neither the name (I’m trying to swap it from First to Second) or the elements added to the list. 3. All the changes are detectable in the graph:

Aleksander Rendtslev 2020-12-13T01:36:59.342900Z

Jakub Holý 2020-12-13T08:46:58.344500Z

Is there the info about which version of Fulcro works with which version of Insepct somewhere? Thank you!

Jakub Holý 2020-12-13T11:14:56.344900Z

Sorry I am off computer. Look into the data-targeting namespace and the mutations ns

Jakub Holý 2020-12-13T11:23:15.345200Z

Is that so that the DB is as you expect only the UI does not reflect it? If so, try force render from Root - does it help? app/schedule-render! - find it in the book

Aleksander Rendtslev 2020-12-13T11:51:58.345500Z

Yes, the DB is as i expect it to be. Ok, I'll try that. I'm still puzzled though if that's the case. I would expect an app of 4 defsc components to update as expected (otherwise i fear having to default to force rerenders for everything if i can't expect components to reliably update). My next steps are: - try a force rerender - add another component and see if that one works - try calling a mutation from the other component to see if changes are isolated to the component from where they're triggered (that would be puzzling to me as well)

Aleksander Rendtslev 2020-12-13T11:52:43.345700Z

Thank you for pitching in!

Aleksander Rendtslev 2020-12-13T12:23:06.345900Z

I figured it might have to do with my usage of transact!! which would make sense since it optimizes for funneling changes down to the text-input? (Reading through the notes it sounds like that might be exactly it) But I tried doing an explicit transact! (which should be asynchronous) on a button to push the change to the other component, and I’m still not seeing the change in the interface

1👍
Aleksander Rendtslev 2020-12-13T13:05:09.346100Z

Aleksander Rendtslev 2020-12-13T13:05:46.346500Z

Aleksander Rendtslev 2020-12-13T13:20:10.347700Z

Ok, Sorry for the long and winded sharing session. Boiling it down to basics helped: My issue was that I hadn’t connected the EntryPanel query in root:

1
Aleksander Rendtslev 2020-12-13T13:21:35.347900Z

Aleksander Rendtslev 2020-12-13T13:22:25.348300Z

(feel free to ignore all this, but I was hoping seeing the pitfalls and the gotchas of someone starting to use the framework might be helpful. I’ll be documenting all of these in an internal FAQ/Gotchas)

Jakub Holý 2020-12-13T17:03:16.348500Z

You mean the bintray custom for matters for clojurescript in Chrome, I suppose?

tony.kay 2020-12-13T17:43:50.348700Z

The releases section of the repo

tony.kay 2020-12-13T17:44:51.348900Z

Fulcro 3.4+ new inspect, otherwise older one

tony.kay 2020-12-13T17:54:52.349100Z

Pifall numbers 1,2,3,4,5: failing on query/ident/initial state

1🙌
wilkerlucio 2020-12-13T18:11:58.351700Z

hello, I'm trying to play with Fulcro RAD demo repo, but having trouble to start the client, the server seems to work fine, but on the client its not, the first thing I noticed is that index.html points to a js file js/example/main.js, but that file doens't exist, the path for the cljs compilation is js/main/main.js. I changed that, also noticed the call for <script>com.example.client.start();</script>, which I can't find either, so I just removed it (also checking on shadow cljs it already points to a different init fn). after that I'm getting some other strange errors on the console.

tony.kay 2020-12-13T18:19:01.352100Z

@wilkerlucio hey there

1🙂
tony.kay 2020-12-13T18:19:14.352400Z

I was not aware of it being broken in any way…let me look

tony.kay 2020-12-13T18:19:31.352700Z

you on develop branch?

tony.kay 2020-12-13T18:19:44.352900Z

actually they are same 🙂

tony.kay 2020-12-13T18:20:27.353100Z

using right port?

tony.kay 2020-12-13T18:20:39.353400Z

should not be using the index.html file at all I think

wilkerlucio 2020-12-13T18:20:57.353600Z

ah, prob wrong branch

wilkerlucio 2020-12-13T18:21:00.353800Z

just cloned, came on master

wilkerlucio 2020-12-13T18:21:03.354Z

trying develop now

tony.kay 2020-12-13T18:21:22.354200Z

http://localhost:3000/

tony.kay 2020-12-13T18:21:34.354500Z

and do NOT add index.html to it

tony.kay 2020-12-13T18:21:45.354800Z

I need to fix the middleware on that, and remove that file

tony.kay 2020-12-13T18:22:00.355100Z

that serves a stale old file if you say index.html

wilkerlucio 2020-12-13T18:22:38.355800Z

makes sense, yeah, I was starting from the shadow http port

tony.kay 2020-12-13T18:22:54.356200Z

Also, in general, I recommend the Datomic db adapter if you use one…it is way better tested. The SQL one works, but it has a number of little annoyances and limitations right now

wilkerlucio 2020-12-13T18:23:05.356500Z

cool, thanks, its working now

wilkerlucio 2020-12-13T18:23:07.356900Z

yeah, using datomic

tony.kay 2020-12-13T18:23:08.357Z

great

tony.kay 2020-12-13T18:23:23.357300Z

I’ll make it a bit more foolproof…

wilkerlucio 2020-12-13T18:24:14.358300Z

I have a suggestion, keep the index.html, but leave a link there like: &lt;a href="localhost:3000"&gt;This is the wrong HTML file, click here to go to <http://localhost:3000>&lt;/a&gt;

wilkerlucio 2020-12-13T18:24:38.358600Z

so if the fool is like me, it will see after trying to start from shadow, hehe

tony.kay 2020-12-13T18:28:02.359300Z

I think removing it worked ok…the correct port will tolerate it because of mw, and the shadow only opens a test port, which shows tests.

tony.kay 2020-12-13T18:28:59.359400Z

??? That was a bit of word salad to me, @holyjak

tony.kay 2020-12-13T18:34:18.359600Z

tony.kay 2020-12-13T18:34:23.360Z

tony.kay 2020-12-13T18:35:22.360400Z

Chrome dev tool settings, Console section, “Enable Custom Formatters”

tony.kay 2020-12-13T18:36:29.360600Z

The deps include:

binaryage/devtools                  {:mvn/version "1.0.0"}
will automatically be able to format cljs objects in the console when that is enabled, which will be much easier on the eye in error messages.

2020-12-13T18:40:01.362100Z

How do you deal with components that have the same representation but are different entity types in the DB? Just define two components and factor out the body to a function?

Jakub Holý 2020-12-13T18:51:31.362200Z

Damn the autocorrection and not checking my text when in hurry! Sorry for that. Yes, that was exactly what I meant.

Jakub Holý 2020-12-13T18:54:10.362600Z

Thanks!

genekim 2020-12-13T18:58:05.362800Z

@holyjak @tony.kay Holy smokes, thanks for the help — after 2-3 hours of peeking into values inside of datomic-wrap-save and to-one-txn (using tap> and reveal), I finally discovered that the env / attribues didn’t have any of my session attributes installed… …because I forgot to add my Session attributues to the attributes vector. Another big face palm. But OTOH, this has given me about 5 hours of exploration into how underlying machinery works. A bit embarrassed that I could have fixed it without even leaving my session.cljs file… But, feeling AWESOME THAT MY FORM SAVE WORKS!!! 🎉🎉🎉.

1
tony.kay 2020-12-13T18:59:43.363Z

yeah, it is unfortunate I don’t have more time to document…right now you have to kind of carefully comb over each bit of demo to make sure you understand why each thing is done, and if you need it in your circumstance

genekim 2020-12-13T19:03:22.363200Z

It’s all good — I’m taking lots of notes, and planning on writing exactly what the steps required are to get my reports and forms working… …and what any surprises were… One of them is definitely what you said: it’s all surprisingly simple, with values being flowed through all the machinery. I think the missing thing is just showing what the major components are, and how they fit together — I’ll share with you whatever I come up with sometime today. Great work on Fulcro RAD. I think it definitely can achieve a “Ruby on Rails” level of magic — meant in only the most complimentary way, of course! 🙂

1❤️
genekim 2020-12-13T19:05:14.363400Z

(I’m also writing up what dynamic changes can be made w/o restarting anything (datomic-common), and for those that can’t, what exactly is required to be restarted (entire server, server + middleware reload, etc.) That was a source of some frustration, because until today, I wasn’t being very methodical about taking notes, and so kept wondering why my code changes weren’t being reflected. 🙂

tony.kay 2020-12-13T19:06:30.363600Z

There’s a new call that you can make that should update queries on hot code reload…which is a big improvement, but you have to call it in the reload that shadow calls

tony.kay 2020-12-13T19:06:33.363800Z

not sure if that is in demo

Jakub Holý 2020-12-13T19:06:35.364Z

Are you suggesting Wilker is a fool? :troll: (Excuse my bad jokes.)

tony.kay 2020-12-13T19:07:05.364200Z

I think he’s the one that suggested that, but he and I are good friends 😜…so it would not be surprising for us to tease each other a bit

Jakub Holý 2020-12-13T19:07:46.364500Z

I guess that is what I would do though I have not encountered this problem yet.

tony.kay 2020-12-13T19:09:01.364700Z

It is: (comp/refresh-dynamic-queries! app)

tony.kay 2020-12-13T19:09:42.364900Z

without that (before the remount) queries won’t update….of course initial state is a hard reload (technically you could fix that at the REPL as well, but it would disrupt current app state)

genekim 2020-12-13T19:26:12.365300Z

Awesome! By the way, is there a way to test the mutation/save to database without having to use the web client? Currently, the only way that I know how to test if models are correct is logging in, navigating to forms in client, edit, update value, save…. 🙂

2020-12-13T19:31:21.365500Z

Thank you. Seems obvious but I always wonder if it's the idiomatic way of doing things.

tony.kay 2020-12-13T19:46:52.365700Z

certainly, you can just call the parser with a save mutation in CLJ, OR you can use the save-form! from the form ns on the server and hand it a diff

tony.kay 2020-12-13T19:50:55.366Z

In fact, that’s the easy way to write mutations that need to do something on server when it isn’t a form…write it up as a form diff and hand it to save-form!

1
tony.kay 2020-12-13T19:51:04.366200Z

writes across all databases automatically 🙂

tony.kay 2020-12-13T19:51:08.366400Z

so cool

genekim 2020-12-13T20:26:46.367500Z

🤯🤯 Wow! Okay, will give that a try! I know what form diffs look like now! 😂😂

genekim 2020-12-13T20:48:26.371900Z

That is so cool. Oh and one more question! 😃😃 Can you point to an example or idiomatic way to have a button that when pushed, tells the server to run a function (eg, do a REST call to an external API): take this session info and update it via the Vimeo API) I see examples of triggering arbitrary actions on the JavaScript client, but not how to call something on the Clojure server.) Thank you!

tony.kay 2020-12-13T23:52:14.372100Z

You mean on a report or form? The controls section. Just make a control button, and have the :action run a full-stack transaction (or do whatever)

tony.kay 2020-12-13T23:52:45.372300Z

you can do that on row action buttons or in control sections.

tony.kay 2020-12-13T23:53:24.372500Z

If you actually mean you want to talk to REST, you could do an http-client thing, or you could make a Fulcro remote that adapts REST API to EQL.

tony.kay 2020-12-13T23:53:57.372700Z

the http-client thing is “ok”…the callback would just call something like Fulcro’s merge-component to put the data in the database.

tony.kay 2020-12-13T23:54:30.372900Z

The “idiomatic way” is to hide that behind a formal remote…you can make a client-side pathom parser that handles that