Fork me on GitHub
#om
<
2015-11-30
>
Tim01:11:55

is om development being phased out?

Tim01:11:03

replaced by om next?

dnolen01:11:22

No new features but it will be maintained for foreseeable future

dnolen01:11:57

And when things settle down the feasibility of bridging will be investigated

Oliver George04:11:40

I'm experimenting with :remotes and :send. The autocomplete example helpfully demonstrates a simple example and is my reference point for this question. In that example, both the read and send function coordinate about where data will live which is the :search/results key in the state.

Oliver George04:11:55

That effectively hard codes the send function. It has no context which would allow it to respond to requests and put data in other locations.

Oliver George04:11:23

I guess you could hash the query and use that as a key but I suspect there are more elegant approaches.

Oliver George04:11:16

So, direct question, what would you change to make the AutoCompleter suitable for use multiple times on a page?

noonian05:11:22

@olivergeorge: You could give AutoCompleter an ident and change your parsing code to recursively call the parser for the data for each AutoCompleter in your app. I think there is a tension between creating truly reusable components (which probably dont have their own queries) and components that are reusable within your application but are tied to your applications specific parser implementations

grounded_sage05:11:27

Hey @dnolen just wondering is there plans to support the ReactDOMServer.renderToStaticMarkup Would be awesome to be able to build static sites for clients in Om and simply add the backend whenever it becomes necessary.

sander06:11:07

@grounded_sage: can't you already use that function?

mudphone06:11:44

Does anyone have a pointer on what {:keyfn …} as arg to om/factory is used for?

noonian06:11:20

@mudphone: it’s used to compute a react key from a the props passed to a component, e.g. if you are rendering a list of contacts you might return the contact’s id for the key

sander06:11:23

@mudphone: docs: "Can optionally supply :keyfn - this should produce the React key property from the component props."

mudphone06:11:48

ah, okay, should have looked there… was looking at source

grounded_sage07:11:29

@sander: docs say Equivalent to React.renderComponentToString. For example

sander07:11:33

@grounded_sage: tried (js/ReactDOMServer.renderToStaticMarkup my-component)?

grounded_sage07:11:51

I haven't actually built anything yet. Just been reading docs etc. print screening for future reference

danielgrosse08:11:23

@dnolen: regarding the problem with the compiled version from Nov. 27th. After cleaning the output directory and recompiling the cljs, it’s working. Maybe some intereference with the development files.

mudphone08:11:33

Anyone know why mutation of app state would not cause a re-render of a component on the first mutation? But would cause re-render on subsequent mutates? I can see that my @reconciler state is changing, but the re-render isn’t triggered. It works fine if I use an atom (and so, no indexer). But, when I switch to handing a non-atom, it doesn’t re-render on the first mutate.

artemyarulin08:11:36

btw - I’m quite tired of converting cljs maps to js all the time dom/div #js {….}. Wouldn’t it be useful to extend dom/[NodeName] functions and apply this transformation automatically during runtime?

noonian08:11:00

You can use other react dom generation libraries to get that syntax. Checkout https://github.com/weavejester/flupot for dom/[NodeName] style or https://github.com/r0man/sablono for hiccup style [:div.foo {:on-click #(println “hiccup style”)}]

johanatan09:11:07

@mudphone: I wasn't aware that non-atoms were supported. I'd imagined that Om uses the Clojure facility to watch for changes to the atom.

mudphone09:11:37

@johanatan: sorry, I guess I should have asked in #C0DT1AZD3

johanatan09:11:50

@mudphone: Is there some difference between the two in this respect? What facility of Clojure will Om Next be using to 'watch' random (non-referency) things?

mudphone09:11:43

@johanatan: I’m new to this, so take with a grain of salt… Om Next has a reconciler which you can pass an atom or non-atom. If you use an atom, it doesn’t normalize the data.

johanatan09:11:16

@mudphone: ya, I just considered that part of my Om Next template to be boilerplate lol: I only plan to have one component and one atom.

johanatan09:11:42

[Everything else is happening within those]

mudphone10:11:06

@johanatan: ah, I see. Well, looks like more debugging is required on my end.

sander11:11:01

the query in Project is specified as [:project/id :project/title {'[:project/current _] [:project/id]}]

Oliver George11:11:17

Thanks @noonian, I'm looking into that now. I can see that having an ident gives the read function :query-root (the ident) in the env and also the :query. The ident would identify a sensible unique path to keep a component's state. Not sure how that helps regarding the send function's callback. Unless merge! uses the query-root / ident as the starting point for the merge. I can't see that from a code skim.

chedgren12:11:00

Whats the om way of thinking about input type range? Suddenly there's this element in the dom that get's to call the shots about things.

chedgren12:11:09

Or is it just a question doing the element.value and putting that where it goes?

griffio12:11:05

@chedgren I don’t think it is much different, e.g using a Slider control, than the auto suggest example https://github.com/omcljs/om/wiki/Remote-Synchronization-Tutorial#building-a-simple-auto-completion-widget. Om can use things like core async to “tame” the controls behaviour!

Tim16:11:31

So it seems to me, that in om , in the second argument to a component, you can pass in :state, init-state or opts. ie (om/build my-component data {:state {:my-foo “foo”} :init-state {:my-bar “bar”}, :opts {:my-foo-bar “fubar"}})

Tim16:11:40

is this right? and does init-state clobber or override the init-state function if the component has one?

dnolen16:11:08

(Om Now) override, you can give state from outside

dnolen16:11:34

that probably won’t come back in Om Next

Tim16:11:10

interesting

noonian18:11:27

@olivergeorge: I’d checkout the thinking in links tutorial. You will have to change your queries a little bit but if you give each autocompleter a unique ident based on its props, you can use Om’s tree->db function to see how Om will normalize your initial data. I’d imagine you’d have something like a list of “ident”s at the :app/searches key or something and your client side parser would pull those out, filter by the proper id from your parameterized search, and call the parser again (also in remote mode) so that each autocompleters :search/results query will be parsed.

dnolen22:11:09

@tony.kay: I added some cosmetic feedback about OM-507 before I take the PR. Thanks for working on this one.

codonnell22:11:10

I think there is a minor typo in the Person component of the Components, Identity, and Normalization tutorial.

codonnell22:11:48

In the line (let [{:keys [points name foo] :as props} (om/props this)] I don't think there's any reason foo should be in there

tony.kay23:11:49

@dnolen: OK. I'll look at it. Welcome...yeah, both of those took some work...bout half the weekend

dnolen23:11:26

@tony.kay: I’m also more than happy to pull and do that myself simple_smile

dnolen23:11:43

I just didn’t want to stomp on what you’d done

tony.kay23:11:55

I don't mind learning the style you prefer...and the alg tips are appreciated

tony.kay23:11:13

Only been doing clojure for 6 mos...so still learning the cool tricks

dnolen23:11:22

@codonnell: feel free to fix that

dnolen23:11:49

@tony.kay: k just let me know what you’d rather prefer

dnolen23:11:59

it would probably be easier to take your PR and see my edits afterwards

dnolen23:11:05

but again I’m not picky at all here

tony.kay23:11:32

ok..well, I do have 8 guys I'm training, and I would like the bug fix...so if you don't mind I'd appreciate it.

tony.kay23:11:47

I will definitely look at the changes

tony.kay23:11:51

@dnolen: scratch that if you've not already done it...It's just 3 changes and I'm already there.

tony.kay23:11:30

@dnolen: take a look and see if I got them all (I got fnil, but I only found delim problems in the test).