Fork me on GitHub
#fulcro
<
2020-04-30
>
jaide03:04:38

I’m a little more familiar with SQL than graphing. The sample:

(fdn/db->tree [{:friends [:list/label]}] (comp/get-initial-state app.ui/Root {}) {})
Is kind of like?
SELECT label FROM (SELECT friends FROM state) list

dvingo14:04:48

i think that's a fair comparison. the other piece is that in fulcro you'll get back a tree of data (nested maps) instead of a table with foreign keys that you'd have to turn into a tree with the sql

jaide20:04:29

Ah I see, so it's almost like including SQL JOIN statements?

dvingo21:04:27

i suppose you could think of it like that, but eventually the comparisons run out because it's a different paradigm. it's a graph db, some similar ideas are things like http://neo4j.com

jaide21:04:56

Fair enough, will just have to let go of the comparisons and treat it as something new.

daniel.spaniel13:04:18

in the fulcro 3 docs for mutations it says this

but Fulcro 3 includes a way to declare them so that they auto-quote themselves for convenience 

daniel.spaniel13:04:47

does this mean we no longer have to use (declare-mutation blah `blah) anymore ? I think it does

dvingo14:04:40

you don't need to quote them if there are no circular dependencies (mostly would happen with a component that uses the mutation and a mutation that uses a component ns) http://book.fulcrologic.com/#_using_defmutation that section has the info on a mutation now returning itself as a list when call as a function

daniel.spaniel15:04:07

gotcha .. @danvingo thanks .. i read that and was just confused a bit but happy to do longer have to use that declare-mutation anymore

grischoun16:04:01

I am trying to use the external react component ‘material-table’ in my app, but I am getting the following error:

Uncaught Error: Element type is invalid: expected a string (for built-in components) or a class/function (for composite components) but got: undefined. You likely forgot to export your component from the file it's defined in, or you might have mixed up default and named imports.
Here is a summary of how I am using it:
(:require ["material-table" :refer [MaterialTable]])
...
(def mtable (interop/react-factory MaterialTable))
...
(mtable ...)
For testing purpose, I have also tried to import a VictoryChart component as shown in the Fulcro book and that works. What am I doing wrong with material-table?

Tuomas16:04:58

I would try

(:require ["material-table" :default MaterialTable])

grischoun17:04:52

Yes, it fixed it. Thank you very much @UH9091BLY.

dvingo19:04:38

are there any best practices for encoding errors from server responses? Specifically for validation and auth sort of concerns - do you just come up with a well-known key in your all your server responses :server/message :server/error or something and then pull that out of the :result of the env? It would be great to use returning but then you'd need every component to know about the server interaction field

dvingo19:04:23

i think this has what i'm looking for http://book.fulcrologic.com/#_demo_of_mutation_joins

👍 4
grierson21:04:55

Does workspaces work with Fulcro 3? can’t get it to detect any cards

dvingo21:04:58

are you using nubank.workspaces.shadow-cljs.target ?

dvingo21:04:59

or browser

grierson21:04:14

nubank.workspaces.shadow-cljs.target

dvingo21:04:23

i think the custom target broke with the recent shadow and/or cljs release

grierson21:04:40

This is my setup

dvingo21:04:41

:workspaces  {:target     :browser
                        :modules    {:main {:entries [app.demo-ws] :init-fn app.demo-ws/main}}
                        :ns-regexp  "-(test|ws)$"
                        :output-dir "resources/public/workspaces/js"
                        :asset-path "/workspaces/js"
                        :devtools   {:preloads           [com.fulcrologic.fulcro.inspect.preload]
                                     :http-root          "resources/public/workspaces"
                                     :http-port          8023
                                     :http-resource-root "."}}

dvingo21:04:54

this is from the fulcro template, I updated it to this and it's working

dvingo21:04:59

but for me, the build was failing completely, so i'm not sure you're having the same issue

Björn Ebbinghaus21:04:19

The key for root is wrong You are using ::f.portal/root it should be: ::ct.fulcro/root

grierson21:04:49

@U4VT24ZM3 Updated to ct.fulcro and still not loading the card

grierson21:04:58

Updated to ::ct.fulcro/root but still blank

wilkerlucio23:04:07

@grierson hello, are you requiring the file? you can use the workspaces target to automatically load, otherwise you have to require the namespaces yourself

grierson09:05:25

Fixed it. Just needed to delete js files. Thanks! 🙂

tony.kay22:04:37

@grierson Yes, but it pulls in F2 deps, so I don’t recommend using the nubank one

tony.kay22:04:50

I’ve published an alternate fork version that is written in F3

tony.kay22:04:38

At some point I expect Wilker might merge that back as official, but he was still so heavily using F2 that he has not.