These are chat archives for SmartFocus/reactjs

4th
Feb 2015
Matt Bilbow
@mattbilbow
Feb 04 2015 11:25
@edjafarov - Do you have an example of Stores using business logic? I haven't come across that yet
Eldar Djafarov
@edjafarov
Feb 04 2015 11:28

http://fluxxor.com/what-is-flux.html

Note that it does not contain knowledge about how to actually update the stores—the stores themselves contain this business logic. Each store is responsible for a domain of the application, and only update themselves in response to actions.

I saw statemens like this here and there
and I guess in some talks too
this is important for me since I am building isomorph architecture
and I decided not to use classic flux for that
Firtina Ozbalikci
@toxicFork
Feb 04 2015 11:32
hmm
Note that it does not contain knowledge about how to actually update the stores—the stores themselves contain this business logic
the ‘business’ is the updating of stores
Eldar Djafarov
@edjafarov
Feb 04 2015 11:33
yep
Firtina Ozbalikci
@toxicFork
Feb 04 2015 11:33
so i think that makes sense still in that context, i thought stores would do more ‘business logic’ than that, which made me confused
Eldar Djafarov
@edjafarov
Feb 04 2015 11:34
like
they will probably do more
action says: add item
James Cleveland
@radiosilence
Feb 04 2015 11:34
oi
Eldar Djafarov
@edjafarov
Feb 04 2015 11:34
and store adds it
:)
action says get more: store checks what it got and takes more
Firtina Ozbalikci
@toxicFork
Feb 04 2015 11:35
well yes but that's still very specific to 'store, add this item to yourself',
depends on how you define 'get more'
Eldar Djafarov
@edjafarov
Feb 04 2015 11:35
sure
Firtina Ozbalikci
@toxicFork
Feb 04 2015 11:35
store shouldn't go and do an ajax request for example
Eldar Djafarov
@edjafarov
Feb 04 2015 11:35
as I get it - it should
Firtina Ozbalikci
@toxicFork
Feb 04 2015 11:35
the 'action creator' or whatever should do the ajax, get the data, and then spoon it into the store's mouth
stores should be as dumb as possible
Eldar Djafarov
@edjafarov
Feb 04 2015 11:36
atleast as I got from graphQL/relay stores do that
I might be wrong
Firtina Ozbalikci
@toxicFork
Feb 04 2015 11:36
haven't seen graphQL, but if they do that then they may be wrong ;)
at least if they want to be flux-struct
strict*
Eldar Djafarov
@edjafarov
Feb 04 2015 11:36
:))
I might be wrong either:)
I am not the guy with 2yrs flux experience
I also think that stores should be as dumb as possible
and all the thing should be really simple
And my feeling is that flux is the overengeneering
Juho Vepsäläinen
@bebraw
Feb 04 2015 11:40
i agree that stores should be dumb. i ended up pushing queries to actions in reflux. they then modify stores or trigger error handling based on results
Eldar Djafarov
@edjafarov
Feb 04 2015 11:40
:+1:
I am trying to get syntaxis like this:
https://gist.github.com/edjafarov/ef59240cc53f840bd68e
Juho Vepsäläinen
@bebraw
Feb 04 2015 11:43
there's a nice comparison at https://github.com/voronianski/flux-comparison
at the moment many solutions struggle with isomorphism. the big problem is that many rely on singletons, reflux included
Eldar Djafarov
@edjafarov
Feb 04 2015 11:43
yep, I saw it
I know this @voronianski guy
I know the problems with singletons
it is essential that on client you can have single context
Juho Vepsäläinen
@bebraw
Feb 04 2015 11:45
i expect that the next generation of these libs solve that more effectively
Eldar Djafarov
@edjafarov
Feb 04 2015 11:45
but on server you need to have context per request
Juho Vepsäläinen
@bebraw
Feb 04 2015 11:45
a friend mentioned something about using react contexts but there's no official api yet
Eldar Djafarov
@edjafarov
Feb 04 2015 11:45
yes, I am using React.withContext
Matt Bilbow
@mattbilbow
Feb 04 2015 11:46
That’s a real nice comparison
Eldar Djafarov
@edjafarov
Feb 04 2015 11:46
it is not that flawless but works
Matt Bilbow
@mattbilbow
Feb 04 2015 12:09
James Cleveland
@radiosilence
Feb 04 2015 14:03
Context is handy. Which they'd put it in stable tho
it scares me that it could just change up
Firtina Ozbalikci
@toxicFork
Feb 04 2015 14:12
still doesn't feel right to have context, i'd still prefer passing things explicity :P
Eldar Djafarov
@edjafarov
Feb 04 2015 14:13
context might make sense on server
Firtina Ozbalikci
@toxicFork
Feb 04 2015 15:17
does react's event system allow you to get all the keypress events even if no element is focused?
Eldar Djafarov
@edjafarov
Feb 04 2015 15:18
To do that I am wrapping the app into a component that catchem all
Firtina Ozbalikci
@toxicFork
Feb 04 2015 15:20
heh, i see
yeah i thought of doing that too
i guess i'll just do it :P
Eldar Djafarov
@edjafarov
Feb 04 2015 15:21
there is no other way I guess
not a big deal though
Firtina Ozbalikci
@toxicFork
Feb 04 2015 15:21
how do you pass events down to the children?
i thought of having a custom event emitter in the context that the children can then subscribe to (e.g. with a mixin)