Fork me on GitHub
#reagent
<
2016-10-02
>
gerred03:10:36

i’m throwing out Elm and about to switch over to cljs + re-frame.

gerred03:10:44

incredibly impressed by what I saw.

shaun-mahood04:10:50

@gerred: Welcome! Any particular reasons you're making the switch?

gerred04:10:47

@shaun-mahood: I’ve flirted with clojure/clojurescript over the years, and thought I was bandwagoning with everybody else when it came to static compile-time type checking being such a productivity boon. I’m sure it is, but I got stuck in edit-compile-run-debug hell almost immediately with ML family languages.

gerred04:10:29

i was going to speak about aws lambda on cljs but I had a sick family member sadly. 😕

gerred04:10:55

so I’m familiar with it at least from that side, but not really on the frontend side, so I’m excited.

gerred04:10:30

I come from Ruby though and I’m at the point where I’ll just ride out the statically typed craze, hang out in my dynamic language happy zone until the cycle ends. 😉

shaun-mahood04:10:10

@gerred: Aah, I thought your name looked familiar. I can’t argue with that logic, the instant feedback is extremely nice for front end work.

gerred04:10:59

I think I sit in flow better solving minor bugs in that style than I do having to parse a massive type compile error.

gerred04:10:11

even if Elm’s errors are great, its still a break to trace the types through.

reefersleep11:10:12

@gerred: I use Clojure and ClojureScript. was hoping to try out Elm and experience swifter resolving of type errors, hopefully aiding me in some of the situations where ClojureScript's confusing stack traces would confound me. With the reputation of Elm's error messages, I find it interesting that you still value solving bugs in ClojureScript more - this sounds controversial to me. So I hope that you do get to do that talk, or maybe do a blog post on it or something 🙂

savelichalex11:10:34

Is there any way in reagent to specify component prop types?

andre12:10:38

hi. is there any way to render form constantly?

reefersleep12:10:43

@savelichalex since components are just functions, I guess you can cljs.spec them or use plumatic/schema.

reefersleep12:10:46

@andre: I don't understand your question 🙂 Maybe try rephrasing it or explain your need or context?

andre12:10:53

yes. i understand that my question has no answer 🙂 i have very specific case

andre12:10:13

i have broken data structures, and reagent doesn't understand it, ratom is changing . but reagent doesn't see that, so i want just constantly recalculate render function each frame

reefersleep12:10:13

What do you mean when you say "broken data structures"?

andre12:10:25

i'm transferring data between two windows, they have different js context which cljs doesn't support

reefersleep12:10:21

If you have data of some format/type, is one solution not to translate it into a ClojureScript datastructure and just update the r/atom normally?

reefersleep12:10:41

Or is it too complex/difficult to convert?

reefersleep12:10:17

I think you are going in the wrong direction when you're talking about calculating the render function on each frame.

andre12:10:39

a have cljs datastructure, i tried cognitect.transit to transfer data. but it demanding on big data, so it's cheaper to render each frame

reefersleep12:10:48

Well, I guess you can derefence some key in your r/atom and have a go-loop that updates that changes the value of that key every milisecond 🙂 Or something like that.

andre12:10:19

ok thank you i'll think in that direction

yury.solovyov14:10:03

What's the most efficient way working with selected items in the list? I mean I need to keep track of selection somewhere, but when list gets long, switching selections becomes slow

yury.solovyov14:10:00

currently I use clojure set for selection and contains? predicate to know if the item needs to have selected class

yury.solovyov14:10:54

using set as a function works the same

yury.solovyov14:10:49

I guess the best way would be just not to render that many items and introduce some kind of pagination

reefersleep15:10:18

How long is your long list? 🙂

reefersleep15:10:52

In the cases I've worked with, the items have had an ID, and we've had a key in the app-state r/atom named something like :my-list/selected-id. Then deref that in the list component to decide arbitrary stuff.

reefersleep15:10:21

@andre: Good luck, I hope you find something that works!

yury.solovyov16:10:54

it takes ~350-400 ms to update selection

yury.solovyov16:10:41

it seems like most of that is consumed by react and not data structures traversal

reefersleep16:10:44

That does sound long. I don't know what's reasonable, though.

yury.solovyov16:10:28

yeah, usually it is not that long, but I've opened up my pictures directory....

reefersleep16:10:53

If it's react taking too long, I guess there's not too much to do except paginate?

yury.solovyov16:10:23

yeah, I wish there was some ready-to-use component for that...

yury.solovyov16:10:50

but it seems like I have to reinvent it or do an interop

andre16:10:45

@reefersleep thank you, i decided to recalculate form, it works good

reefersleep17:10:31

@andre great that it worked out! 😄

shaun-mahood18:10:12

@yury.solovyov: I don't know of anything specific for reagent, but you might be able to use or get ideas from https://github.com/bvaughn/react-virtualized

yury.solovyov18:10:39

oh, looks very close

yury.solovyov18:10:44

thanks, will take a look

yury.solovyov18:10:23

though, it seems like it is js component, I wonder if it is on cljsjs

shaun-mahood18:10:56

Oh awesome - I haven't needed it yet but it looks like a really good project. Hope it works for you!

yury.solovyov18:10:28

not the latest version but still seems good enough, thanks