Fork me on GitHub

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


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


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


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?


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


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.


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


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 ?


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


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


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


that sounds pretty lightweight


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


i have used 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


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


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