Fork me on GitHub
#rum
<
2017-03-30
>
grounded_sage12:03:40

Hey I know this has been answered before but I seem to be unable to search for it in Gitter.

grounded_sage12:03:08

Just wondering how I can do "netlify" true or something to that effect. I simply just need to set netlify as an attribute the same way as you would allowfullscreen etc.

grounded_sage12:03:46

I previously did this by just setting everything as dangerously setting HTML but I would much prefer to do this the right way.

grounded_sage13:03:57

I've opened an issue for this. As it is getting rather painful to work with 😞 https://github.com/tonsky/rum/issues/129

jimmy13:03:45

@grounded_sage is there anyway you can set it to something like data-netlify

misha13:03:48

does react allow data- prefix on custom attributes?

jimmy13:03:01

@misha good point, it doesn't seem to support it for now. They have something called dataset

grounded_sage13:03:31

I know that tonsky said that they should say data- but netlify doesn't do that 😕

misha13:03:00

and it is still open harold

grounded_sage13:03:56

Oh god. So I can't even use data- ...

grounded_sage13:03:21

Because I was planning to use Snipcart for e-commerce

jimmy13:03:44

@misha interesting

DOMProperty.injectDOMPropertyConfig({
  Properties: { amp: DOMProperty.MUST_USE_ATTRIBUTE },
  isCustomAttribute: attributeName => attributeName.startsWith('amp-')
})

grounded_sage13:03:31

Surely I can still use snipcart. They have tutorials online with React 😕 Anyways that is rather painful. Mega sad face

misha13:03:15

that's why I shared. looking for actual ReactInjection code to have a look

jimmy13:03:27

@grounded_sage you can try something like this

ReactDOM.findDOMNode(this.test).setAttribute('custom-attribute', 'some value');

jimmy13:03:43

find the dom-node then setAttribute before letting netlify takes over

jimmy13:03:07

if you can trigger that form build manually in didmount

misha13:03:17

its a local "hack"

grounded_sage13:03:30

I do server side rendered as well.

grounded_sage13:03:48

So that could be more of an issue 😕

jimmy14:03:08

does that netlify work on server side as well ?

grounded_sage14:03:03

Does it generate the html with the custom netlify attribute you mean?

jimmy14:03:42

I can assume that netlify only works in javascript env, not on server side. So basically your form being rendered on server ( without netlify of course ) and client ( before netlify transforms the form ) are the same ?

grounded_sage14:03:39

I need to comment out the dangerous setting to check

misha14:03:51

rum does not use react on server, afaik. so your attribute will come through. Now the challenge is to register it in react

grounded_sage14:03:57

Yea I saw one of his talks where he said it's just CLJ and does all the mapping as best as possible

rauh14:03:21

Have you actually tried if data-netflify works? I'd be very surprising, data-* has been a standard for a few years now. People shouldn't make up their own attributes

grounded_sage14:03:55

I will give it a go @rauh

grounded_sage14:03:23

@misha it does indeed work serverside. So I guess I can just hack at it client side to get it to work 😕 Though will try with data- first.

jimmy14:03:52

@grounded_sage check their javascript source code. They shouldn't make up their own attribute.

grounded_sage14:03:58

Might be easier to hammer it on Netlify's end

misha14:03:34

since reactinjcetion is around for 2+ years, I think this is the way to go (if data- is not an option in some cases)

grounded_sage14:03:11

Thanks I've screenshotted to reference later. Man I am experiencing some weird shit atm. Throwing up the page on netlify and the attribute isn't present but a method="post" is. When locally the generated html is how I want. 😕 My other side worked fine. So frustrating 😞

misha14:03:26

so yeah, this is the way to go:

DOMProperty.injectDOMPropertyConfig({
  Properties: { amp: DOMProperty.MUST_USE_ATTRIBUTE },
  isCustomAttribute: attributeName => attributeName.startsWith('amp-')
})
just need a function to make it pretty in cljs

grounded_sage14:03:49

@rauh @nxqd seems that data-netlify doesn't work for me? So strange

rauh15:03:09

@grounded_sage Would be interested if misha's approach works

misha15:03:57

then help me to import damn thing in #clojurescript kappa