On Sunday, May 17, 2015 at 8:15:56 PM UTC+10, Ruslan Prokopchuk wrote:
> Re: Javelin & subscriptions.
> 
> Code to mimic subscriptions with cells and to use them as ratoms in Reagent 
> code is pretty straightforward:
> 
> Definition: 
> https://github.com/ul/ampere/blob/master/src/ampere/adapters/reagent.cljs#L5
> 
> Usage in Reagent view: 
> https://github.com/ul/ampere/blob/master/examples/todomvc/src/todomvc/views/reagent.cljs#L30


Hey, good to see re-frame port, and also work on applying FSM. I really think 
there's a lot of potential in that direction. 

But I can see 3 potential problems ... 

First, when the UI is a bit dynamic and Reagent components are being created 
and destroyed, I think that use of add-watch in subscriptions might cause a 
memory leak ... worse because they don't go away, you'll end up with old unused 
ones firing and slowing things down.  At least, it seems like that on first 
look (claim untested). 

Second, for larger apps, you want your subscriptions to be created only when 
needed.  When you have "page 10" open, you don't want "page 2" subscriptions 
firing because that page isn't even visible (rendered).  Your approach appears 
to require that "cells" and "formulas" for all possible subscriptions are 
created up-front (and are then used by subscriptions).  Again, on first glance 
that seems like it would work for a simple case, but not scale up.   

Third, subscriptions sometimes need to be parametrized. I wonder how that would 
be done?

There might well be solutions to all these issues, and perhaps I missing 
something, but I thought I'd jot these notes down quickly.

--
Mike

-- 
Note that posts from new members are moderated - please be patient with your 
first post.
--- 
You received this message because you are subscribed to the Google Groups 
"ClojureScript" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to clojurescript+unsubscr...@googlegroups.com.
To post to this group, send email to clojurescript@googlegroups.com.
Visit this group at http://groups.google.com/group/clojurescript.

Reply via email to