Fork me on GitHub
#reagent
<
2016-01-28
>
harold04:01:22

The lein new reagent template seems to rely on java webservers - is there an example somewhere of deploying reagent with just html, css, and js files?

harold04:01:50

(ideally also developing with fighweel as the lein new reagent template is nicely set up with)

harold04:01:28

Wow @gadfly361 - this looks tremendous, I'll try it out now. Thank you.

firinne10:01:10

@gadfly361: are you using any of the semantic-ui transitions in soda-ash? I’m looking to rotate a cube, but trying to do it an event based way (similar to petrol), and want to avoid using jayq

juhoteperi14:01:42

Does anyone know a way to force Schema validation (`schema.core/with-fn-validation`) for components? I think in Om :instrument function could be used for this.

gadfly36115:01:10

@firinne not yet, hoping to have time soon to start tackling things like that. See my comment in this issue which points to some relevant discussion. https://github.com/gadfly361/soda-ash/issues/1

jaen15:01:42

@juhoteperi: But wouldn't (schema/defn component [prop :- PropSchema] ...) work since Form1 and Form2 components are just functions?

juhoteperi16:01:43

@jaen: Schema does not do any validation by default, only when when enabled with s/with-fn-validation or if function has :always-validate metadata, which I don't want to use as I only want to use validation in dev

jaen16:01:30

Ah, I see; what you mean is that you want to validate components only, yes?

jaen16:01:44

But then, wouldn't using schema/defn for components only work?

juhoteperi16:01:33

schema.core/defn is used to annotate functions, it doesn't enable validation by default

Michael Griffiths16:01:51

@juhoteperi: can you use schema.core/set-fn-validation! but in dev only?

Michael Griffiths16:01:04

Or do you only want it enabled for certain fns?

juhoteperi16:01:35

Oh I forgot that one. That will probably work.

jaen16:01:59

Lol, reading comprehension fail; I actually thought you were writing set-fn-validation! instead of with-fn-validation '

jaen16:01:19

And was kinda surprised why that wouldn't work; this explains it.

juhoteperi16:01:09

I was somehow thinking that with-fn-validation would be implemented using dynamic var instead of that strange global state, so I thought there was not global way.

Michael Griffiths16:01:36

Yeah, pretty surprising - I almost think they should be with-fn-validation! / without-fn-validation! to make it clear they’re mutating something global (otherwise you might use it when connected to a REPL in production)

juhoteperi16:01:13

Related to this, I wonder if there is a way to catch exceptions from Reagent so I could catch those Schema errors and control how they are reported?

juhoteperi16:01:02

Looks like I can use window.onerror to catch the exceptions

Michael Griffiths16:01:20

Yeah, we use window.onerror (via TrackJS, but no reason using it directly wouldn’t work)

juhoteperi17:01:59

Okay got that implemented nice.

juhoteperi18:01:23

Next I would like to get hot reload working after I fix some code which threw exception during rendering. Currently I get Uncaught TypeError: Cannot read property '_currentElement' of null and I have to reload the whole page

bevy18:01:10

I'm trying to use custom elements (polymer's paper-dialog), but custom attributes get stripped. Apparently React allows custom attributes in custom elements (https://github.com/facebook/react/pull/3752), does reagent not?

bevy19:01:39

the attributes are shown in the react dev tools view, but they don't appear on the actual html elements in the elements view.

hugobessaa20:01:31

@juhoteperi: i hit this problem too

bevy21:01:46

I can get them working by using create-class with :component-did-mount #(doall (for [[k v] attributes] (-> % (.getDOMNode) (.setAttribute (clj->js k) (clj->js v))))) Is there a way to change the default value for :component-did-mount for create-class?

shriphani23:01:49

Hi, I’ve been using reagent to build a simple SPA and I want to add a custom script tag to the index.html. I can’t find one in the default project so I guess it is autogenerated. Does anyone know where the head > script tags are generated? thanks.

bevy23:01:01

@shriphani: how did you create the project? Did you use a template?

shriphani23:01:18

@bevy: lein new reagent app-name

amonks23:01:08

@shriphani: src/clj/[app-name]/handler.clj

shriphani23:01:20

@amonks: thanks - really appreciate it