Hi, thank you both for your suggestions.
I guess I will separate by functionality and then by handlers / subs / .... I think for larger applications handlers and subs become harder to track down when you put them all into one file. > BTW, there is definitively some view code in that repo which worries me. You > absolutely shouldn't be embedding calls to "subscribe" in the middle of view > render functions: > - > https://github.com/sveri/siwf/blob/b5290c59c050119f3cf035122085427dadfba654/src/cljs/de/sveri/siwf/files/upload.cljs#L60 > - > https://github.com/sveri/siwf/blob/b5290c59c050119f3cf035122085427dadfba654/src/cljs/de/sveri/siwf/files/uploded_files.cljs#L36 > > I believe those lines would be odd reagent, much less re-frame. Hm, I never thought about that. What exactly would be better, putting them at the top of the function like so: (defn foo [] (let [files (subscribe .... Or pass them into the function from the very top like this: (defn foo [files]... (defn top [] (let [files (subscribe .... (foo files)... Best Regards, Sven Am Sonntag, 22. März 2015 10:19:55 UTC+1 schrieb Mike Thompson: > On Sunday, March 22, 2015 at 12:37:20 AM UTC+11, Sven Richter wrote: > > Hi, > > > > I was integrating re-frame in the last days into an application that I am > > working on. Now, after finishing one "page" I get the feeling that my > > structure is messy and after a few days of a break I have a hard time to > > mentally follow the dataflow in my application, related to the code. > > > > This are the three files I am referring to: > > https://github.com/sveri/siwf/blob/b5290c59c050119f3cf035122085427dadfba654/src/cljs/de/sveri/siwf/files/files.cljs > > https://github.com/sveri/siwf/blob/b5290c59c050119f3cf035122085427dadfba654/src/cljs/de/sveri/siwf/files/upload.cljs > > https://github.com/sveri/siwf/blob/b5290c59c050119f3cf035122085427dadfba654/src/cljs/de/sveri/siwf/files/uploded_files.cljs > > > > > > Any ideas how to do that "better"? Especially the fact that I cannot really > > follow mentally makes it hard for me to code in this pattern. Harder than I > > expected tbh as the derived values thing really makes sense in general. > > > > Anything else worth pointing out in that code? > > Hi Sven, > > I follow the layout in the example todomvc (in the repo) which involves > handlers.cljs, subs.cljs, db.cljs, views.cljs and I find navigation of the > resulting source fairly easy. Its always seems pretty clear where to look > for something. > > Mike Haney's code might also provide some guidance: > https://github.com/mdhaney/homesale-clj/tree/master/src/homesale > > Your example has the complication of using resumablejs, but I can see you are > updating it in event handlers, which seems the right approach to me (although > I know little of resumablejs). > > BTW, there is definitively some view code in that repo which worries me. You > absolutely shouldn't be embedding calls to "subscribe" in the middle of view > render functions: > - > https://github.com/sveri/siwf/blob/b5290c59c050119f3cf035122085427dadfba654/src/cljs/de/sveri/siwf/files/upload.cljs#L60 > - > https://github.com/sveri/siwf/blob/b5290c59c050119f3cf035122085427dadfba654/src/cljs/de/sveri/siwf/files/uploded_files.cljs#L36 > > I believe those lines would be odd reagent, much less re-frame. > > -- > 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 [email protected]. To post to this group, send email to [email protected]. Visit this group at http://groups.google.com/group/clojurescript.
