Fork me on GitHub
#om
<
2016-11-10
>
danburton00:11:03

@anmonteiro any chance that you could cut a new alpha release of compassus including this change? https://github.com/compassus/compassus/commit/2122406a26392d840dd9df3daf8645de520677e6

levitanong07:11:00

is using parser inside the env argument in the parser functions intended for running queries within the parser functions?

matthavener18:11:42

levitanong: I think so.. for recursive parsing

petterik19:11:23

For server side rendering, the content inside a (dom/script) is being html-escaped. Is this correct? Is there a way to avoid this? Example

(dom/render-to-str (dom/script nil "foo('bar');"))
=> "<script data-reactroot=\"\" data-reactid=\"1\" data-react-checksum=\"-1720051763\"> foo(&#x27;bar&#x27;);</script>"

anmonteiro19:11:56

@petterik probably a bug. We need to check how React acts in that case

anmonteiro19:11:09

@petterik hrm:

(dom/render-to-str (dom/script nil "'foo bar'"))
"<script data-reactroot=\"\" data-reactid=\"1\" data-react-checksum=\"1770461025\">&#x27;foo bar&#x27;</script>"

anmonteiro19:11:13

seems like the correct behavior

anmonteiro19:11:20

(this is at the node repl using react dom server)

petterik19:11:38

chrome complains about Unexpected token &

anmonteiro19:11:42

you'll have to do it like this:

cljs.user=> (dom/render-to-str (dom/script #js {:dangerouslySetInnerHTML #js {:__html "'foo bar'"}}))
"<script data-reactroot=\"\" data-reactid=\"1\" data-react-checksum=\"-1734339355\">'foo bar'</script>"

petterik19:11:42

(When it gets the html from the server, generated with dom/render-to-str)

petterik19:11:11

cool! that worked. Thanks!

petterik19:11:56

Actually no. My errors went away, because it renders it as nothing 🙂

petterik19:11:13

(dom/render-to-str (dom/script {:type "text/javascript" :dangerouslySetInnerHTML {:__html "'foo'"}}))
=> "<script type=\"text/javascript\" data-reactroot=\"\" data-reactid=\"1\" data-react-checksum=\"297998988\"></script>"

anmonteiro19:11:54

we might not handle dangerouslySetInnerHTML in Om

anmonteiro19:11:56

open an issue please 🙂

petterik20:11:02

@anmonteiro Verified that it works with a simple string and in our app with more complex examples! Thanks creating a patch so fast!

anmonteiro20:11:16

awesome 👍

petterik20:11:52

question, should I close the issue now that I've verified it? Or is that something you do when the pull request has been merged?

anmonteiro20:11:44

should be closed when the PR is merged

anmonteiro20:11:47

it's OK to leave it open

sophiago21:11:46

hi. is it possible to wrap a defui in a function in order to pass it params? i think i may be getting error because of this: "Map literal must contain an even number of forms", either that or i need to bind them somehow?

anmonteiro21:11:37

@sophiago you can do that but ui exists to make anonymous components. i.e.:

(ui
  Object
  (render [this]
    ...))

anmonteiro21:11:05

the error you're getting has nothing to do with any of this, you're most likely creating a map with an odd number of forms 🙂

anmonteiro21:11:16

which means you don't have a value for some key

sophiago21:11:50

ah, right i could have used ui

sophiago21:11:05

ah, interrupted one sec

sophiago21:11:26

sorry...anyway, the reason i asked that specific question was because i figured maybe the param wasn't being passed through hence resulting in the mismatch

sophiago21:11:02

since it's the argument to a selector used as the value to one key

anmonteiro21:11:13

@sophiago hrm something wrong with the syntax there?

anmonteiro21:11:34

matrix(args) is JS, (matrix args) is ClojureScript

sophiago21:11:57

i've never used css matrix transforms in js either tbh

sophiago21:11:03

usually use canvas

anmonteiro21:11:11

well, it's not about matrices

anmonteiro21:11:16

it's about Lisp syntax

sophiago21:11:27

well seems obvious now

anmonteiro21:11:30

you probably also want to drop the # I think

anmonteiro21:11:44

unless you want the div child to be a function

anmonteiro21:11:55

but I suspect you want the result of the function

sophiago21:11:12

ah yes, i had that from calling it as the function in a map

sophiago21:11:17

but not what i want now

sophiago22:11:14

huh, figwheel has not been compiling my code live

sophiago22:11:22

not in cases like this at least

anmonteiro22:11:35

if you have an error Figwheel won't compile

sophiago22:11:35

when the initial pass fails

anmonteiro22:11:50

it should show you its HUD with the error

sophiago22:11:53

it gives you a screen that is misleading to that effect

sophiago22:11:13

but the command line would seem to say run it again, which is what i do

sophiago22:11:29

really exciting now to see how om.next interops with this decent sized library i wrote

sophiago22:11:06

hmm, it's compiling. but i switched to ui and not i'm getting Use of undeclared Var core/ui and errors from the following lines that are also replicated in the js

sophiago22:11:27

that doesn't make any sense to me

sophiago22:11:57

i didn't include it

sophiago22:11:28

not using the correct terminology there. in the require brackets?

sophiago22:11:10

@anmonteiro the matrix syntax...that's not core.matrix you were thinking, but js interop, right? because that seems to be the last warning i'm getting

sophiago22:11:39

it might be the case i just need to quote it and have the symbol "matrix" at the front of the list?

anmonteiro22:11:40

@sophiago uh as I said I didn't mean "matrix syntax", but lisp syntax in general

anmonteiro22:11:10

I'm not sure what you're trying to achieve, but if matrix is a function it needs to be inside the parens

anmonteiro22:11:13

(matrix ...)

sophiago22:11:59

it does seem like that from the css, but doesn't really make sense to have a function inside a selector?

anmonteiro22:11:54

oh.. is matrix a CSS thing?

anmonteiro22:11:19

then everything should probably be inside a string

anmonteiro22:11:24

"matrix( ... )"

sophiago22:11:38

oh no you're correct

sophiago22:11:48

it's a function

sophiago22:11:01

but you're saying it's a function passed as a literal?

sophiago22:11:17

a string literal i mean, not a clojure function literal

anmonteiro22:11:52

hrm, so if it's CSS you need to pass it as a string

anmonteiro22:11:16

like you'd do in plain JavaScript

sophiago22:11:18

ok, thanks. i would never have figured that out

sophiago22:11:36

to pass the function as a string i mean

sophiago22:11:42

ok, seems to have done it

sophiago22:11:51

still not behaving correctly, but error is gone

anmonteiro22:11:13

the next thing is putting #js in front of the map

sophiago22:11:17

and now i have to run to go see rich talk about spec since it'll likely be standing room only and i tend to be late to those things

sophiago22:11:22

oh, missed that

sophiago22:11:42

yeah, there's no map

anmonteiro22:11:22

you only need to pass #js to dom/ stuff

sophiago22:11:59

yeah don't need it there