This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2017-01-04
Channels
- # architecture (13)
- # bangalore-clj (1)
- # beginners (174)
- # boot (25)
- # cider (65)
- # cljs-dev (10)
- # cljsjs (4)
- # cljsrn (3)
- # clojure (169)
- # clojure-berlin (27)
- # clojure-brasil (32)
- # clojure-greece (3)
- # clojure-russia (31)
- # clojure-sg (4)
- # clojure-spec (6)
- # clojure-uk (74)
- # clojurescript (186)
- # code-reviews (5)
- # css (12)
- # cursive (17)
- # datascript (1)
- # datomic (45)
- # dirac (33)
- # funcool (42)
- # hoplon (25)
- # jobs (6)
- # jobs-discuss (114)
- # lambdaisland (6)
- # leiningen (1)
- # luminus (24)
- # off-topic (86)
- # om (13)
- # om-next (14)
- # onyx (75)
- # perun (2)
- # protorepl (19)
- # re-frame (2)
- # reagent (17)
- # ring-swagger (2)
- # rum (1)
- # slack-help (2)
- # specter (31)
- # test-check (5)
- # timbre (1)
- # untangled (34)
- # vim (8)
Yeah I understand what WatchEvent is used for and I think it’s great (I use it for some more complex operations) but it complicates some things I tried to implement as well
I think I’ll need to drop Potok again despite the initial fun:
1. I’d like to use component
and that quickly causes circular dependencies with the store-view
2. I’d like to make-available additional stuff when processing events without introducing globals
(The cyclic dependency appears only because I tried to “inject” the db into the store so I can pass it to event handlers and similar)
at least it does not make sense (the cyclic dependency...), seems like more ortanization problem that potok's problem
I needed access to (fb/->FirebaseStub)
(`:db`) in some event handlers (see point 2) and thought I could parameterize the store (a forked version of it) in a way that would allow me passing additional things to event handlers
later, if you want materialize that state to an "atom" but without db reference, just filter keys that you don't want see on the materialized atom, it is pretty easy to do with rx
yeah, that seems easy enough
I guess I jumped at component to quickly 🙂
yeah maybe. I like the organization and separation it enforces though
forces you to make the dependencies explicit
@niwinz one thing with the state
in watch events btw: The WatchEvent flow is async and the state
is static it could become outdated and result in weird results, right?
@martinklepsch yes and no, if you perform an async op and then you want to acess to state, just emit an other event that does something as a "continuation of flow"
I don’t know I don’t see a huge price for using component except that it doesn’t work well with some things (which can make it unbearable to use some times)
for me this is already high price, designing everything to component and in future found myself, spendig time fighting with, when some new feature that I want to introduce conflicts a little bit with component
I think mount is a good middle solution, on the other hand I'm not using it right now on frontend
Hm, not a fan of mount 🙂
I think “designing everything around component” might have some cost but also makes the boundaries of these components more clear. Which in my experience also makes them often easier to use.
Can you remember what conflicts you had with component?
No conflicts, just the effort of adapt everything to component, and maybe little conflicts like that one that you have had. It is not a hard opinion, is just a pragmatic decsions.
yeah makes sense 👍
I think I’ll try what you suggested, thanks for the pointer 🙂
i didn't like component, but i do like being able to compactly specify systems of objects - i built something with cats to do it - https://github.com/employeerepublic/deferst
(though i haven't made it work on cljs yet)
@mccraigmccraig I’ve been meaning to understand what cats is good for for quite some time 😄 would you mind outlining how it helped with that library?
The code isn’t immediately understandable to me, which is a good reason for me to shy away from using something ...
cats does all the plumbing - i just plugged together a couple of standard monads and coerce everything to type and cats does the rest
i did have to re-invigorate a couple of concepts which got retired from cats though 😬
each object gets built and added to the state with https://github.com/employeerepublic/deferst/blob/master/src/deferst/system.cljc#L110 while https://github.com/employeerepublic/deferst/blob/master/src/deferst/system.cljc#L139 composes all the build operations ... everything else is peripheral
@niwinz I ended up writing a Rum mixin that starts/stops systems and provides it to components via context, pretty happy with that solution I think. Now I want to make a defc
variant that passes (partial emit! store)
as first argument
Maybe I’ll try adapting your component
function for now