Fork me on GitHub
#fulcro
<
2018-08-22
>
vaedasynapse08:08:27

I’m quite new here. Just got to tinkering around and wanted to try my hand at pulling in the css-injection and I don’t know if the book is out of whack with what I have to place in the require or what? Presently I have

vaedasynapse08:08:06

and I’m getting the following error

vaedasynapse08:08:10

So I think either something is off or I’m misunderstanding something.

cjmurphy09:08:00

Are you using "2.6.0-RC8"?

cjmurphy10:08:19

Is :ui/react-key supposed to get changed whenever you save a source code file? Is there anything that needs to be done to make that happen when using shadow-cljs?

tony.kay15:08:24

@vaedasynapse Use RC9…that is brand new

tony.kay15:08:49

@cjmurphy Not needed anymore. Is it still in the book? The hot code reload should do a remount, which does a forced root render, which turns off the short-circuits…so it should just work.

tony.kay15:08:51

The remount should be in your code for reload, though

tony.kay15:08:11

you just need to call mount again if you’ve converting to shadow-cljs using lifecycle hooks

eoliphant16:08:41

Hi, I’m playing around with RC9, shadow-cljs and devcards. I’m noticing that if I say change the body of a stateful component, that ’s referenced in a card. I don’t see the corresponding update in the card without a page refresh. In the console, i see the component, then its it’s card namespace being refreshed, along with the call to ..cards/refresh. Do I need to add something to the (refresh) function?

tony.kay16:08:22

which kind of card are you using?

tony.kay16:08:33

defcard or defcard-fulcro?

eoliphant16:08:35

the ‘regular’ defcard

tony.kay16:08:48

then the shouldComponentUpdate will prevent a refresh unless you change props

tony.kay16:08:04

add a random prop….like :k (rand-int 1000)

tony.kay16:08:10

and it’ll refresh

eoliphant16:08:48

ah ok. yeah was just messing around with layout so handn’t even added props

eoliphant16:08:53

will add that trick

tony.kay16:08:15

defcard-fulcro force refreshes them automatically, but runs them in a complete app context as well..so if you’re just playing with layout (which I so as well), just use the random prop trick

eoliphant16:08:55

that did it thanks. Just wanted to say man, this is an amazing piece of work. I actually tried getting into it some months ago and it just wasn’t clicking. Just finished a good sized re-frame project, and kept hitting places where I kept thinking “fulcro does this for you” lol. So have jumped back in, and it’s making a lot more sense

tony.kay16:08:31

glad to hear it 🙂

tony.kay16:08:07

I keep trying to figure out how to make it easier to get into.

tony.kay16:08:36

but I’m also sapped in terms of time 😞

eoliphant16:08:56

that’s kind of a theme for me with some of this stuff. Started playing with specter last year, and same thing. for more complex cases, it was kind of brain itching.. but then put it aside for a bit, then it made a lot more sense. Yeah the materials are great. I actualy I think kind of messed up. I went straight to the vids and tutorial before. The ‘getting started’ in the docs, is much more manageable to get your feet wet. Yeah I can imagine.. this is a lot of stuff

thheller16:08:35

can someone confirm if this is a valid query? supposed to return some info about all sources required to compile clojure.string

[{[::m/cljs-ns clojure.string]
           [{::m/cljs-sources [::m/resource-info]}]}]

thheller16:08:58

[{[::m/cljs-ns clojure.string] [::m/cljs-sources]}]

thheller16:08:03

works fine without the join

thheller16:08:45

not sure if my join is just wrong or I'm just running into a pathom error

tony.kay16:08:42

I don’t understand the clojure.string bit

thheller16:08:54

[::m/cljs-ns clojure.string] this is an ident basically

tony.kay16:08:03

you’re using a symbol for an ID?

thheller16:08:11

its quoted. yes

thheller16:08:22

just left out the quote sorry

tony.kay16:08:49

join to a query with a subjoin…looks ok at first glance

thheller16:08:33

ok I'll ask in #pathom just wanted to confirm if I'm just doing the join wrong 😛

tony.kay16:08:45

you using connect?

cjmurphy17:08:54

@tony.kay There are quite a few examples of :react-key in code examples in the book (some where it isn't put in attributes to the topmost div). Also in the source doc for style-element it mentions a :react-key - seeing that I started to think it might not be dead after all.

(defn ^:dev/after-load start [] (mount @root-comp))
in a preloaded 'user' namespace does the job for me.

tony.kay17:08:33

ok, yeah, someone should clean those up in the book 😜

eoliphant17:08:58

I’m playing around with the react component wrapper stuff in the incubator. ‘no props’ components don’t seem to be working

...
(:require ["semantic-ui-react" :as sui-react]
....

(def Button (uc/component-factory-simple sui-react/Button))

; in my component
 (sui/Button {} "Hi") ; is fine
 (sui/Button "Hi") ; doesn't render the button content

tony.kay17:08:15

Ah, sorry I closed your issue. I think you’re right. That helper needs to pass children

eoliphant17:08:39

no prob, i filed it then remebered we’d just been talking alol

eoliphant17:08:39

quick question, i’m getting the impression that fulcro tends to engender more of a bottom up approach? was just wondering about the typical development style/pattern

tony.kay17:08:51

well, I’m not certain this is an issue, per-se. The args lists are clear on simple factory, and do not say that props are optional

tony.kay17:08:07

I think you want component-factory-localized

tony.kay17:08:17

well, not really there either

tony.kay17:08:27

because that one does component localization

tony.kay17:08:36

you want a 3rd alternative

tony.kay17:08:37

you want the function component-factory-localized, but with the non-localized helpers

eoliphant17:08:32

yeah i guess more the ‘default’ behavior, where if there are props they’re used, if not it a child/children

tony.kay17:08:23

so, the simple one doesn’t allow that

tony.kay17:08:15

want an easy contribution, copy this function: https://github.com/fulcrologic/fulcro-incubator/blob/develop/src/fulcro/incubator/ui/core.cljs#L13 after importing the regular dom under a diff alias, and use the non-localized stuff the exact same way

eoliphant17:08:54

will check it out 😉

cjmurphy17:08:27

If anybody needs an example of hot code reloading in a shadow-cljs project, here is something: https://github.com/chrismurrph/fulcro-react-vis/blob/c467396ab09be2b18587b4ef0fd9090fa23675a9/src/main/general/user.cljs#L26

tony.kay19:08:06

The fulcro lein template for shadow-cljs should also work

tony.kay19:08:09

(it uses the shadow config file instead of metadata)