# om

This page is not created by, affiliated with, or supported by Slack Technologies, Inc.

cjmurphy 23:44:35

I was doing a very similar thing to you. To get rid of those you can set the reconciler's :logger to nil.

cjmurphy 23:49:32

Or take a look here where did something slightly better than setting it to nil.

cjmurphy 23:53:40

I suspect it will be fast enough to handle mouse events. But we should probably both switch to using local state for the mouse-while-being-moved position, unless it really is needed elsewhere in the application.

adamkowalski 07:37:47

with om next would it be a good idea to talk to a server using web sockets?

nxqd 09:26:37

@adamkowalski: the protocol you use to talk between server and client is your choice :simple_smile:

steveb8n 09:46:29

@iwankaramazow: one alternative (that I’m planning to use) instead of server side rendering is to run the initial query for the app on the server and inject the transit encoded result into the app host page. When the state atom is initialised (but not yet normalised) it can be pre-loaded with this data. That will produce almost the same initial rendering speed as a server side render but without the need for porting all of

nxqd 09:52:54

@anmonteiro: thanks for fixing the bug regarding reindex :simple_smile:

iwankaramazow 10:09:24

@steveb8n: Interesting, this might be a good way in the short term. I'll take a look at it later this week, need to finish partial app loading/code splitting first in this app I'm building

steveb8n 10:12:06

@iwankaramazow: the only downside I can see it that the initial app query needs to be hardcoded in the server. It’s easy to record the initial query but you have to remember to do it every time the client code changes.

iwankaramazow 10:14:51

Is there any possibility to just spin up a node server with its sole purpose to render everything to html?
I vaguely remember some people doing this with a python or ruby backend

danielstockton 10:40:17

npm install http-server; cd project-dir; http-server

danielstockton 10:40:27

python -m SimpleHTTPServer 8000

danielstockton 10:41:01

ruby -run -e httpd . -p 8000

pupeno 10:58:08

How do you normally dispatch to display the the main panel, as in, showing different pages? I have a bunch of react components (defui) for each page, and then I create the factories and then I have a multimethod that dispatches on the page name/route and each method calls each factory. It feels a bit too verbose:
```(defui AboutPage Object (render [this] (dom/div "This is the about page")))

(def about-page (om/factory AboutPage))

(defmethod layout/pages :about [_] (about-page))```

pupeno 10:58:43

I could abstract away quite a bit of it with a macro, but before that, I’m wondering how other people are doing this.

iwankaramazow 11:01:35

Plain old functions here

iwankaramazow 11:02:52

I have something like ((routes/render-page url) (om/props this)) which hides the 'ugly' stuff

pupeno 11:14:50

Well, that uses a hashmap for dispatching, instead of multimethods:

iwankaramazow 11:17:40

@pupeno: Have you implemented some form of link component for routing, i.e. something which renders a (dom/a) + blocks the default click behavior + triggers transition trough history?

pupeno 11:18:03

iwankaramazow: yes.

pupeno 11:19:06

iwankaramazow: pushy is great for that. I did it with both bidi and my favorite, silk. I wrote blog posts about it. It was using re-frame, but it’s possible with Om Next with similar code:

iwankaramazow 11:21:42

I'll take a look at it.
I'm currently stuck with (dom/a) deep in a component hierarchy. I somehow need those components to have access to history or a callback which sets a history token. Currently a circular dependency is drowning the current approach.

iwankaramazow 11:53:45

ah fixed it, I was one (declare ...) away from the solution

nxqd 13:36:46

hi guys how to focus programmatically in, I have set ref on the element and get it via (om/react-ref) but returned ref doesn't have any focus method. Am I doing it wrong ?

sander 15:26:28

@nxqd: maybe you need to call something like (om.dom/get-node (om/react-ref v))?

sander 15:27:32

yeah call om.dom/node on the component that react-ref returns

nblumoe 17:05:50

is it not possible to have subqueries fetched from a remote, if the parent does not get fetched from remote?

nblumoe 17:06:44

the wish to do so might seem odd at first, I have that situation because I have a child component with dynamic queries and this subquery needs to get merged into the root query. that's the only reason for the nesting of queries

danielstockton 17:15:02

Do you really need a child component for this (can't include it in the parent's query)?

nblumoe 17:19:54

that's why I am going to do now. However, I would prefer not to, because then I end up with such things bubbling up to the Root component all the time, when I would prefer to keep it the child

danielstockton 17:22:27

queries have to compose up to root anyway and then you pass everything down through props

danielstockton 17:23:12

hard for me to imagine your specific use-case

nblumoe 17:23:22

yes, but I would like to keep the query params on the child component

danielstockton 17:24:25

its the remote/client split that seems weird, wondering how that would ever come about

taylor.sando 17:36:17

You can remove app-specific parent state from a query using process-roots. You have to mark your remote ast queries using query-root: true

anmonteiro 17:36:26

@nblumoe: doesn't process-roots work for this case?

nblumoe 17:37:46

hm I don't know. did not use it so far at all, will need to check, thx

danielstockton 17:38:04

does anyone have a concrete use-case for this?

hueyp 20:44:44

is there a benefit of computed vs adding a value to props?

iwankaramazow 21:36:03

@hueyp: example?

hueyp 21:37:49

e.g. (item-component (assoc item :foo “bar”)) vs (item-component (om/computed item {:foo “bar”}))

hueyp 21:38:25

not sure if its just an organizational or functional distinction for query props vs other props

iwankaramazow 21:44:25

hmm I just took a look at the source code

iwankaramazow 21:44:41

can't seem to find an immediate benefit

iwankaramazow 21:44:51

correct me if I'm wrong..