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
You need to enable custom formatters
they the error message would have been more understandable because it would have shown you the attribute details
And yeah, there is no UUID form control…you’d have to make one, but that’s easy enough
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:
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:
Is there the info about which version of Fulcro works with which version of Insepct somewhere? Thank you!
Sorry I am off computer. Look into the data-targeting namespace and the mutations ns
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
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)
Thank you for pitching in!
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
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(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)
You mean the bintray custom for matters for clojurescript in Chrome, I suppose?
The releases section of the repo
Fulcro 3.4+ new inspect, otherwise older one
Pifall numbers 1,2,3,4,5: failing on query/ident/initial state
1🙌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.
I was not aware of it being broken in any way…let me look
you on develop branch?
actually they are same 🙂
using right port?
should not be using the index.html file at all I think
ah, prob wrong branch
just cloned, came on master
trying develop now
and do NOT add index.html to it
I need to fix the middleware on that, and remove that file
that serves a stale old file if you say index.html
makes sense, yeah, I was starting from the shadow http port
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
cool, thanks, its working now
yeah, using datomic
great
I’ll make it a bit more foolproof…
I have a suggestion, keep the index.html, but leave a link there like: <a href="localhost:3000">This is the wrong HTML file, click here to go to <http://localhost:3000></a>
so if the fool is like me, it will see after trying to start from shadow, hehe
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.
??? That was a bit of word salad to me, @holyjak
Chrome dev tool settings, Console section, “Enable Custom Formatters”
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.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?
Damn the autocorrection and not checking my text when in hurry! Sorry for that. Yes, that was exactly what I meant.
Thanks!
@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!!! 🎉🎉🎉.
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
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❤️(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. 🙂
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
not sure if that is in demo
Are you suggesting Wilker is a fool? :troll: (Excuse my bad jokes.)
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
I guess that is what I would do though I have not encountered this problem yet.
It is: (comp/refresh-dynamic-queries! app)
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)
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…. 🙂
Thank you. Seems obvious but I always wonder if it's the idiomatic way of doing things.
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
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!
1writes across all databases automatically 🙂
so cool
🤯🤯 Wow! Okay, will give that a try! I know what form diffs look like now! 😂😂
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!
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)
you can do that on row action buttons or in control sections.
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.
the http-client thing is “ok”…the callback would just call something like Fulcro’s merge-component to put the data in the database.
The “idiomatic way” is to hide that behind a formal remote…you can make a client-side pathom parser that handles that