Fork me on GitHub
#re-frame
<
2018-09-05
>
mikethompson08:09:21

@joshua.d.horwitz I'm not sure you have this right

mikethompson08:09:47

You equate re-frame's event handling with redux's creating actions.

mikethompson08:09:15

But, as I understand redux (admittedly not much), that doesn't seem right. re-frame really doesn't involve actions, you just dispatch a vector like [:something a b]

mikethompson08:09:46

event handling (Domino 2) is morethe equivalent of reducers in redux

mikethompson08:09:40

AIUI, redux doesn't really have an equivalent to effect handlers.

mikethompson08:09:04

Hmm. So really reducers is BOTH effect handlers and event handlers. Or something.

Josh Horwitz12:09:24

Essentially, I can go through the article again and I will try to clarify and make it map more clearly. Thanks for reading and the feedback @mikethompson

genekim18:09:34

@andrea.crotti @henrik @samueldev What fantastic timing on the question about multiple SPAs in given project — I ended up doing multiple build targets, but I’m dissatisfied with that, because I have to remember to set up multiple figwheel builds, and CircleCI and Heroku takes 2x as long now to do the production builds. (8-9 mins feels so much slower than 4m) I’d love to figure out how to do it in one build, but I couldn’t get the :on-jsload to work for more than one. The modern-cljs tutorial suggests this can be done (they used /login and /shopping-card as an example), but I couldn’t figure out how to get it to work. (They used boot, I use lein.) Do you know of any examples of how to get re-frame to work with multiple SPAs? PS: @mikethompson: I say I’m “dissatisfied” above, but in actuality, I’m delighted beyond words with re-frame and that I have something working at all! The fact that I could share events, subs, and db, and just rewrite the core and views blows my mind.

👍 2
bhauman18:09:43

@genekim this may or may not help but figwheel.main has a new extra mains feature

bhauman18:09:14

but the overall pattern is very simple

bhauman18:09:24

you can do it without tooling

bhauman18:09:52

look at the main output-to file you are generating

bhauman18:09:08

and change the require for the entry namesapce

genekim18:09:34

Thanks for all your great work, @bhauman! I read your amazing announcement (and the kudos from David Nolan <-- congrats on that notable achievement. 🙂 (Studying this link again, seeing if the lightbulb flickers on this time. Stand by. :)

bhauman18:09:38

and create some extra main js files and index.htmls to require them

bhauman18:09:12

@genekim I just provided instructions, making sure you didn’t miss them?

bhauman18:09:41

first look at your main output-to file

bhauman18:09:49

and copy it

bhauman18:09:00

and require the entry point namesapce

bhauman18:09:09

create an index to host it

genekim18:09:00

Thanks — hang on, trying to get there… mental gears are grinding…

genekim18:09:09

@bhauman I will write up an example when I finally get this to work, because I think a lot of other people may find it helpful. Okay, you can see the horribleness I did to create the new cljsbuild targets of iphone-dev and iphone-min here (the original SPA targets were just “dev” and “min”): https://gist.github.com/realgenekim/441c931ca7e8dc75ccc716aee24cde67 Your instructions are: - copy the old build dev build target: (:output-to “app.js”). So, copy it to “iphone.js” - I have a new “iphone.html” that loads the “iphone.js” - in what file do I a require the new “src/trello_iphone/core.cljs”? Thanks much, Bruce!

bhauman18:09:56

@genekim you would require the what you would normally put in :main for the other build

genekim18:09:31

If this helps…

genekim18:09:50

@bhauman Ah!!! Okay! Got it!

bhauman18:09:11

trello_iphone.core ?

bhauman18:09:31

makes sense right?

bhauman18:09:16

get right of the main ns in the iphone.js and replace it with whatever main you need

genekim18:09:47

Yes! Totally! That was actually the first thing I tried, but of course, before “extra-mains”, that totally did not work as expected. 🙂 I’ll try it out tonight, and I’ll post a minimal example. Thanks again, @bhauman

bhauman18:09:49

you have to munge the namespace and you have to make sure you are watching all the files

bhauman18:09:11

no worries and it will be much easier if you use figwheel.main 😉

bhauman18:09:57

but thats a bigger investment for sure

genekim18:09:33

PS: that is super, super cool. Just curious: for most people, how would you rate the effort of migrating from figwheel to figwheel.main? (e.g., minutes, hours, days, weeks? :)

bhauman18:09:51

if you are not using to many features of lein figwheel I’d say an hour and a half, and that’s simply because you will need to understand how it works. so its mostly going to be time spent reading docs.

genekim18:09:51

Okay!!! I’ll keep you posted on all fronts, @bhauman — catch y’all soon! 🙂

Jp Soares19:09:57

I'm thinking about the architecture of my SPA (to decouple my Business Rules) and I saw the suggested app structure here https://github.com/Day8/re-frame/blob/master/docs/Basic-App-Structure.md. I'm wondering if it makes sense to have the Business Rules as one of the Panels in the suggested structure.