om-next

gws 2017-01-11T01:06:44.000220Z

@viebel What about (js/ReactDOM.render (your-component {:prop "foo"}) (google.dom/getElement "container-id"))?

mavbozo 2017-01-11T04:48:00.000221Z

@viebel

(defui aComp
     Object
     (shouldComponentUpdate [this]
			    false))

1
Yehonathan Sharvit 2017-01-11T05:22:47.000222Z

Thx @mavbozo will try it it soon

Yehonathan Sharvit 2017-01-11T06:08:47.000223Z

In my case, it doesn’t work @mavbozo

Yehonathan Sharvit 2017-01-11T06:09:02.000224Z

But I am realizing that my case is very special

Yehonathan Sharvit 2017-01-11T06:10:14.000225Z

I’m adding a container to klipse

Yehonathan Sharvit 2017-01-11T06:10:18.000226Z

Here is a demo: https://goo.gl/NGAh4Z

Yehonathan Sharvit 2017-01-11T06:10:49.000227Z

When the code contains (require ‘cljsjs.react.dom), it breaks

Yehonathan Sharvit 2017-01-11T06:11:10.000228Z

without it is is fine:

Yehonathan Sharvit 2017-01-11T06:11:34.000229Z

https://goo.gl/ijHZvi

Yehonathan Sharvit 2017-01-11T06:12:24.000230Z

Why does the fact that I’m loading react again (which is a really weird use case) is causing om.next to re-render the components even with shouldComponentUpdate => false?

mavbozo 2017-01-11T07:10:53.000231Z

@viebel the result should be "Hello World!" rendered in right pane ?

Yehonathan Sharvit 2017-01-11T07:11:03.000232Z

yes

Yehonathan Sharvit 2017-01-11T07:11:40.000234Z

If you remove (require ‘cljsjs.react.dom), this is what you get

mavbozo 2017-01-11T07:12:15.000235Z

when I load your first link, no "Hello World" rendered, but when I ctrl-enter in the code pane, the "Hello World" rendered

Yehonathan Sharvit 2017-01-11T07:12:25.000236Z

I know

Yehonathan Sharvit 2017-01-11T07:12:32.000237Z

this is exactly the problem

Yehonathan Sharvit 2017-01-11T07:12:55.000238Z

when you re-evaluate the code with ctrl-enter, the bug doesnt reproduce,

Yehonathan Sharvit 2017-01-11T07:13:04.000239Z

because react is not loaded again

mavbozo 2017-01-11T07:32:01.000240Z

@viebel have you tried in Container component to render (dom/div #js {:id "klipse-container-wrapper"} nil) and fill its children in componentDidMount ?

Yehonathan Sharvit 2017-01-11T07:32:35.000241Z

Trying now...

Yehonathan Sharvit 2017-01-11T07:33:03.000242Z

how would I fill its children?

mavbozo 2017-01-11T07:33:26.000243Z

just use ordinary js function

Yehonathan Sharvit 2017-01-11T07:34:36.000244Z

Is there a way to use om.dom - inside componentDidMount?

Yehonathan Sharvit 2017-01-11T07:36:33.000246Z

and what will I do inside render()?

mavbozo 2017-01-11T07:37:08.000247Z

basically, your Container component only knows about dom/div id:klipse-container-wrapper , the inside of the klipse-container-wrapper is outside react control

mavbozo 2017-01-11T07:40:22.000248Z

maybe you could put another react root inside componentDidMount, never tried that before. I use that technique when I embed non-react dom library under react components tree

mavbozo 2017-01-11T07:42:20.000249Z

the Container of the non-react dom library just render the div and in componentDidMount I set up the non-react dom.

mavbozo 2017-01-11T07:43:37.000250Z

plus I set Container's shouldComponentUpdate to false

Yehonathan Sharvit 2017-01-11T07:49:35.000251Z

It doesn’t work 😞

Yehonathan Sharvit 2017-01-11T07:49:49.000252Z

Because componentDidMount is called again

mavbozo 2017-01-11T07:53:40.000254Z

so, require-ing cljs.react.dom somehow re-mount react root

Yehonathan Sharvit 2017-01-11T07:53:49.000255Z

Exactly

Yehonathan Sharvit 2017-01-11T07:54:08.000256Z

I don’t know if it’s a om.next bug/feature or react

Yehonathan Sharvit 2017-01-11T07:54:16.000257Z

Anyway, I need a way to prevent it

Yehonathan Sharvit 2017-01-11T13:11:30.000258Z

@anmonteiro maybe you have an idea about ⬆️