Fork me on GitHub
#fulcro
<
2020-08-15
>
crteal04:08:03

I'm new to Fulcro (coming from om.next) and having some trouble writing a custom remote, and I'm hoping somebody can help me or point me in the right direction. I'm following the example from the book (http://book.fulcrologic.com/#_writing_your_own_remote_implementation) about what to pass the result-handler function (e.g., a map with body, original-transaction, and status-code) with the intention of getting a merge of the value in body to the root of my database. Specifically, I want to see data returned from my custom remote like this {:audio/duration 100} end up in my database (such that afterwords I could (get @state :audio/duration) which would return 100). However, I can't seem to make that happen, even if I set the original-transaction value to [:audio/duration], which appeared to be documented/possible from my reading of the section of the book about merging (http://book.fulcrologic.com/#_merging_state)... I've looked at the implementations of the mock and HTTP server provided by Fulcro, but couldn't tell what it was that I'm doing wrong. I assume there is something fundamental that I'm missing, but any help or guidance on this is greatly appreciated. thank you!

Adam Helins11:08:19

Out of curiosity, is there a particular reason namespaces went from fulcro.* to com.fulcrologic.fulcro.* ?

souenzzo15:08:11

fulcro.* is fulcro v2 com.fulcrologic.fulcro.* is v3 You can use both at same time

tony.kay16:08:17

I’m following the general principle that if it is a different thing, it should have a different name. 2 and 3 are not API compatible, they are API-alike. Also, I wanted to split things into more nses to improve incremental compile speed. The standard Java naming convention, which I’ve used, is simply a good idea to prevent collisions in global space…Have you seen a project by Rich that doesn’t use the convention? My earlier versions were “trying to fit in” with the naming I saw commonly in CLJ libs (I come from a Java bg, and always thought the naming conv was good idea). After I got better at Clojure, I realized the common convention was either laziness or aping crappiness from other places. So, rather than inventing new shorter names that were crappy, I went with what I consider to be safer, more well-reasoned names from Java-land, as Rich has. IDEs will auto-complete them, so “typing convenience” isn’t much of an argument not to, but is the only one people ever seem to try.

Adam Helins17:08:02

That's a complete answer, thanks!

JAtkins14:08:30

Compatibility afaik - you can have fulcro 2.x and 3.x in the same project

tony.kay16:08:40

Technically you can mount an F2 and F3 app on the same page, but I don’t ever recommend using both that the same time in a project, since it is way too easy to require something from one and use it in the other and end up with a bug that is terribly difficult to figure out.

JAtkins18:08:43

Agreed - it bit me when I was initially spinning up a F3 project with the F2 version of workspaces. Took me 4-5 hours to find out that it was a typo in the imports.

tony.kay18:08:59

That;s why I forked workspaces…so you would not end up with both 😄