Fork me on GitHub
#reagent
<
2016-07-20
>
johanatan01:07:45

hi, does anyone know how to force a render on window resize in reagent?

johanatan01:07:41

with re-frame I am thinking of adding a signal for the window size and just subscribing to it. is there a better way?

johanatan02:07:06

[for anyone following along, the above ^^^ worked marvelously]

reefersleep13:07:22

Trying to understand the resource needs of Reagent: If I can tell (through a (prn "drawn")) that a component function is called repeatedly during interaction with a page, does that mean that I am hogging a lot of resources with each call? I mean, supposing I am not causing heavy computations or side effects other than changing the page state. As I understand it, Reagent will only redraw the elements which are actually changed, not the tree carrying that element - even if the tree is called again. Is this right?

reefersleep13:07:58

And DOM manipulation is the heaviest part of Reagent, resource-wise. Yes? 🙂

reefersleep13:07:14

Asking because my app seems a bit slow, for example upon entering text in a [:input {:type :text}]. Each stroke causes a delay before the next.

mccraigmccraig13:07:08

@reefersleep: yes, reagent/react will do minimal-ish dom updates, and if parents are unchanged they won't get re-rendered

mccraigmccraig13:07:55

dom manipulation is often the heaviest part of an app, but it depends on what your app is doing - what's happening in response to keypresses ?

reefersleep13:07:23

just #(swap! state assoc :entered-text %), that's why I'm wondering

reefersleep13:07:23

And then there's an next-button which reads (:entered-text @state) as well as a couple of other vals to see if it should be disabled or not

reefersleep13:07:58

it's just a form and some validation (before you press the next-button) 🙂

mccraigmccraig14:07:12

that sounds pretty lightweight

reefersleep14:07:45

I don't know if it's just because I'm running figwheel, haven't tried compiling for production

mccraigmccraig14:07:16

i have used https://github.com/Day8/re-frame/wiki/Debugging to great effect before when i've been debugging perf problems... only the component bit is applicable to vanilla reagent, but it gives you deep insight into what exactly is going on in your app

mccraigmccraig14:07:38

production compiles make a lot of difference to load-times, not so much to loaded performance

reefersleep14:07:37

I'll give it a go, thanks a lot!