Fork me on GitHub
#reagent
<
2015-11-25
>
mike11:11:25

any reagent benchmarks against om elm etc?

jonas17:11:58

I’m reading the changelog for the upcoming release https://github.com/reagent-project/reagent/commit/348ac4aaf86dd120d0aa254dc06c5efa5991ce22 Anyone know what "Support [:> nativeComp {:foo "bar"}]” will mean?

mike17:11:44

> jstew: I feel all warm and tingly inside. I figured out how to make select2 work with reagent simple_smile (albeit in a hacky way but it works)

mike17:11:13

@jstew you are sitting on top google closure library which has the bestest autocomplete made by human being.

mike17:11:43

why hacking into select2?!

jstew17:11:36

@mike: unfortunately to make it work with an opinionated bootstrap theme that looks gross unless you use their components (Flat-UI)

mike17:11:40

closure library's ac should fit nicely with reagent.

jstew17:11:00

It's not even for the autocomplete functionality.

jaen17:11:35

select2 is pretty cool anyway

mike17:11:55

bloated.

roberto17:11:14

what is a google closure library that can be used instead of select2?

mike17:11:56

and free advanced optimization.

mike17:11:54

at the very least you could go with http://jedwatson.github.io/react-select/

mike17:11:18

but it's not as nice as closure ac, IMO.

roberto17:11:26

I had never heard about those

jstew17:11:32

I can't really complain, select2 relies on jquery and has it's own API. Which is understandable considering that it wasn't designed with react or clojurescript in mind.

roberto17:11:27

yeah, I don’t have issues with select2. Finding google closure alternatives isn’t so easy.

mike17:11:28

@jstew: what about the overhead? you're using clojurescript which comes with closure library stuff and then on top of that you'll have jquery.

roberto17:11:03

i think the overhead isn’t a problem, the main focus is getting it built. If it isn’t built, you can’t worry about overhead anyway

roberto17:11:27

damn, even googling for Automcomplete Remote Google Closure doesn’t return good results

mike17:11:46

that's because closure library is hugely underrated 😞

mike17:11:57

but you know what...

mike17:11:09

the input box that you just googled with...

mike17:11:23

that's the very same autocomplete by closure library.

jstew17:11:27

There are not many entry level tutorials for the closure library and the docs aren't the greatest either.

roberto17:11:43

it looks good, but for someone that is not familiar with the google closure ecosystem, it is difficult to find. While I don’t have to be familiar with jquery to find select2 and start using it.

mike17:11:56

I'm really surprised.

jstew17:11:09

That's what I've been finding when I have to work with it. Luckily there are smart people in slack that I can get info from simple_smile

mike17:11:15

clojurescript is shipped with closure library interface.

roberto17:11:24

now that I know about closure’s autocomplete, I’ll investigate it some more, but really, the closure libraries and ecosystem is obscure

mike17:11:30

also, you're using reagent, which is based on react.

mike17:11:45

the last thing that you want to do is to go back to jqeury ui.

jaen17:11:51

Honestly, the documentation for GCL is just bad, I can't really understand it (but same goes for documentation of most Java libraries).

mike17:11:52

what am I missing here?

roberto17:11:01

clojurescript is also shipped with google guava, do I have to know that or be concerned with the libraries in google guava

mike17:11:17

@jaen I agree, but there is (only one) excellent book on it.

roberto17:11:26

select2 is shipped with jquery, doesn’t mean I have to know every single library or utility in jquery

mike17:11:48

also look the github project, google started to take it seriously after many years of public inactivity.

roberto17:11:49

it is also probably an opportunity to write good docs about google closure.

roberto17:11:02

from personal experience, google documentation is horrible

roberto17:11:17

the only one I’ve had a good experience with was Guice

mike17:11:52

I don;t know why google does this.

mike17:11:00

I'm really mad at them.

roberto17:11:08

yeah, I just had to write an app that uses their spreadsheet API

roberto17:11:14

reading through their docs was a nightmare

roberto17:11:36

maybe they don’t care about good docs because they are more focused in getting internal use.

mike17:11:46

clojurescript is the only open source project that got closure library power right.

roberto17:11:49

maybe they have better docs internally

mike17:11:26

which part of documentation is the problem?

mike17:11:34

the code itself is very very much documented.

jaen17:11:38

Also re-com has a pretty nice select component. I've cannibalized it once to add multiple selection and was quite satisfied.

mike17:11:39

(and annotated)

jaen17:11:59

I think this is exactly the problem

mike17:11:03

it's very easy to follow the code.

jaen17:11:15

While understandable and commented code is good

jaen17:11:20

it is not a substitute for documentation

jstew17:11:29

It's easy to understand the code if you know where to start and what to look for.

mike17:11:41

just start from the demos.

roberto17:11:44

i won’t go reading code (especially javascript code) when I’m on a deadline

mike17:11:01

it's not a jquery style code simple_smile

roberto17:11:11

i have never had to dig into jquery source code

mike17:11:15

closure library is made to be readable by a huge team.

mike17:11:35

I meant a jquery based ui component.

roberto17:11:13

when I’ve had to read jquery code, it was mostly for educational purposes. But most of them are very well documented.

roberto17:11:33

and yes, I agree, closure is superior, but if the docs are horrible, it won’t get much usage.

mike17:11:46

again, the api docs are excellent.

roberto17:11:53

api docs don’t help

roberto17:11:00

api docs are useful when you know what you are looking for

roberto17:11:17

I can’t point a java newbie to the java api docs

mike17:11:20

doesn't clojurescript work with closure library out of the box?

roberto17:11:22

it won’t help them

roberto17:11:37

yes, and backbone works with jquery out of the box

mike17:11:39

maybe my impression is wrong.

mike17:11:49

so that's all you need.

roberto17:11:08

so, if I use your analogy

roberto17:11:15

someone coming to clojure, without any java experience

roberto17:11:20

should be able to understand java code

mike17:11:21

var tcMovies = [
        "Mission Impossible", "Top Gun","Jerry McGuire","Rain Man",
        "Days of Thunder", "Risky Business","Interview With The Vampire",
        "Eyes Wide Shut","Far And Away", "Jerry Maguire","The Firm","Cocktail",
        "A Few Good Men","Legend","Taps", "The Outsiders","Losin' It",
        "Endless Love","The Color Of Money", "All The Right Moves",
        "Minority Report","Magnolia","Mission Impossible 2",
        "Mission Impossible 3","Vanilla Sky","Ghost Soldiers","Few Good Men A",
        "Color of Money The","Firm The","Mission Impossible II","Outsiders The",
        "Young Guns","Top Gun DVD","Days of Thunder DVD","Coctail",
        "Mission Impossible DVD","Fallen Angels Vol 1","Don't Look at Me",
        "Young Guns uncredited"];

    var ac1 = goog.ui.ac.createSimpleAutoComplete(
        tcMovies, document.getElementById('txtInput1'), false);
    var ac2 = goog.ui.ac.createSimpleAutoComplete(
        tcMovies, document.getElementById('txtInput2'), true);

mike17:11:28

this is all you need for ac.

roberto17:11:13

how do you make something like tags that you can do in select2?

mike17:11:02

it has remote and rich remote, but no tags mode.

mike17:11:11

it should be easy with reagent.

mike17:11:30

that's the whole reason I'm trying to start with clojurescript.

mike17:11:44

closure library ui is verbose to extend.

mike17:11:02

I'm hoping react based components make it easy.

jaen17:11:02

But how do you customise it?

jaen17:11:07

Select2 has a lot of customisation

jaen17:11:10

This doesn't seem to

jaen17:11:23

what if I want a different matching algorithm?

mike17:11:00

it has an extensive matcher.

mike17:11:22

tag mode is just a visual trick. after entering, you just keep a list of elements with tags style.

roberto17:11:30

yeah, select2 might be inferior code wise, but you can build something much faster by just reading the docs.

roberto17:11:47

That is why just the apis don’t work as docs. You have to know about ‘matchers’.

roberto17:11:52

for example

jaen17:11:14

But you know about it

roberto17:11:17

that react autocomplete looks better tho. Even the source code is much easier to understand than closure's

jaen17:11:21

I wouldn't even know how to look for it

roberto17:11:30

@jaen that was the point I was trying to make

jaen17:11:49

When I wrangled with Google Closure Compiler I had to figure out what it's doing with trial and error

jaen17:11:51

No docs at all

jaen17:11:56

And it was really annoying

mike17:11:33

I donno guys,.. I've always enjoyed and learned a lot from closure library.

mike17:11:08

when I build a component on closure lib, I know it's rock solid, works down to ie 7.

mike17:11:02

if you cannot take my word, hear it from the man himself:

jaen17:11:32

@roberto: yeah, I agree with that point, when all you have is javadocs you don't really know where to start biting into the library. For a university project I was doing a Clojurescript frontend for a backend in Groovy. When I had to modify that for my convenience and there wasn't much docs besides API docs figuring out how the hell do I change data serialisation format took me literally hours.

roberto17:11:36

yeah, people confuse api docs, tests and source docs for good documentation on HOW to use something.

roberto17:11:44

The others are good if you want to know how something works.

roberto18:11:00

most of the time I don’t care how something works, I just want to know how to use it.

jaen18:11:35

I dunno, not saying Rich made a wrong decision building on GCC and GCL, the tree shaking thing is pretty awesome, but I think he might have the Java mindset - if there's Javadocs then it's awesomely documented and readily usable. I despise Java and Javadocs give me nothing in the way of understanding how to deal with something. I tried to use this once - http://oltu.apache.org/ - because all Clojure oAuth provider libraries were missing refresh tokens and this lib had it and I couldn't make head or tails of how to use it.

roberto18:11:44

yeah, javadocs are good as a reference, which you need once you are familiar with a library. But if you are not familiar with it, javadocs are not much help.

roberto18:11:28

it is like saying, if you want to learn OCaml, this should be enough http://caml.inria.fr/pub/docs/manual-ocaml/libref/

Tim18:11:48

oracle has awesome java tutorials

jaen18:11:38

Won't make me want to learn it anyway xD

Tim18:11:57

it would be cool to get a full stack reagent app running on node

jstew18:11:32

tmtwd: You mean like electron + reagent and clojurescript on the backend with node?

Tim18:11:54

but thats kinda cool too

mpdairy21:11:13

does anyone know how I could make a non-component function run after every react update?

mpdairy21:11:10

i've got components running db transactions and I want to combine the transactions and only actually transact! them after the components are done rendering

mpdairy21:11:12

maybe I could use a reaction and deref it in the main app component

gabe21:11:12

@mpdairy: i think that would call your function BEFORE the components start rendering.

gabe21:11:47

but assuming componentDidUpdate is called depth-first (parents called after children) maybe you could put your function at the top-level component

gabe21:11:08

but that is an assumption of mine. i have no idea if it’s correct