This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2017-03-16
Channels
- # aws-lambda (3)
- # beginners (20)
- # boot (201)
- # cljs-dev (45)
- # cljsrn (9)
- # clojars (19)
- # clojure (141)
- # clojure-china (2)
- # clojure-dev (11)
- # clojure-greece (6)
- # clojure-italy (1)
- # clojure-new-zealand (1)
- # clojure-romania (1)
- # clojure-russia (55)
- # clojure-spec (58)
- # clojure-taiwan (1)
- # clojure-uk (97)
- # clojure-ukraine (40)
- # clojurescript (77)
- # core-async (5)
- # core-typed (1)
- # cursive (35)
- # datomic (9)
- # jobs (2)
- # jobs-rus (25)
- # juxt (8)
- # lein-figwheel (14)
- # luminus (24)
- # mount (16)
- # off-topic (56)
- # om (36)
- # onyx (22)
- # pedestal (3)
- # perun (14)
- # re-frame (111)
- # reagent (5)
- # remote-jobs (6)
- # ring-swagger (3)
- # slack-help (1)
- # specter (17)
- # unrepl (12)
- # untangled (56)
ok, I guess this applies: https://github.com/Day8/re-frame/wiki/Using-%5Bsquare-brackets%5D-instead-of-%28parentheses%29
@mikethompson is this crazy? https://gist.github.com/isaksky/2cc3779b52305e992c6150863454a9af
@isak No, not keen on debouncing subscriptions. Just not the right place. Events change things. They do re-computations. They should handle debouncing, etc. Subscriptions are a much more passive set of dominoes. You are trying to create stateful subscriptions which .... is ... bad. > What if the check isn't the problem, but the number of places? Why don't you put the check on everything? If X changes them dispatch Y. Identity check on X, so virtually no overhead. (And then handle debouncing via a debounced dispatch)
You can easily add a interceptor to every event handler Other than that .... do it this way (see point 2) https://github.com/Day8/re-frame/issues/255#issuecomment-274303581
@mikethompson Hm, isn't there more state for the user of the functionality that way, though? Because they need to worry about starting and stopping the :subscription->event with that way. With the function I had, at least the state is just internal.
I see that there is a new reagent with-let
function that can help, but then you'd still need to write event handlers that actually spit out the right effects to start and stop
I could do the check for every handler, but its not just one value, it is a handful. Wouldn't it also become problematic if that became a standard pattern in the codebase? Potentially a bunch of things that got checked for everything. Seems a shame to not be able to use the normal reaction logic
hi all , wanted to find out if there is a way to effecitvely stream/load parts of my re-frame app as needed , so when i hit the site initially only the code that is needed to load the login page is sent to the browser , once i login the rest can be loaded
@mikethompson is the re-frame lein template kept deliberately behind on some dependencies? I see it was updated a few days ago but lein ancient revealed quite a few older libs and i wondered if there might be compatibility issues that were driving those?
i've never tried it out @rc1140 but you may want to start here - http://swannodette.github.io/2015/02/23/hello-google-closure-modules
@mccraigmccraig thanks , will check it out
assuming the modules stuff works smoothly it looks fairly straightforward to split a re-frame app up, as long as you do it along namespace lines - perhaps with a core.cljs file for each module which makes sure all the subs, handlers and views for that module get required ?
What is a good way to log just the name of the events that are dispatched by re-frame in the console?
i think you will find it exactly what you are looking for, unless you absolutely want them in the browser console rather than a pop-up window
@sandbags I’m trying this now: https://github.com/flexsurfer/re-frisk#web-applications-with-re-frame
Hi, just to say that I just finished my first webapp with re-frame — took me a week, with lot of change coming from the end customer and all the while learning the framework : it was fun, fast, and a pleasure to debug. If only everything could be so nice… next web app challenge : using re-com, maybe some React component. Let’s hope my joy will not be crushed !
anyone hit "Figwheel Client Version 0.5.7 is not equal to Figwheel Sidecar Version 0.5.9. Shutting down Websocket Connection!" ?
i'm looking in the deps and i cannot see where the version 0.5.7 client is getting roped in from
sigh... despite being a new app this is something cached to do with using localhost:3449
whomever it was that said cache invalidation was one of the two hardest problems in CS was not likely wrong
Anyone use run!
from reagent.ratom in a re-frame app? http://blog.ducky.io/reagent-docs/0.6.0-alpha2/reagent.ratom.html#var-run.21
yea, but re-frame subscriptions are not good for expensive computations that may get triggered frequently
here is a workaround i did yesterday: https://gist.github.com/isaksky/2cc3779b52305e992c6150863454a9af . But I was thinking about run!
then a debounced dispatch as an alternative
yea, but lets say a user can trigger 10 things in quick succession that requires recomputing an expensive dataset - how would subscriptions as-is be a good fit? only 1 recalculation is required
otherwise i guess my instinct would be to use an event, or i don't understand your problem
but, really, i am straying beyond my competence in building re-frame apps, i'll let others with more experience advise you
Couldn't you make a layer of indirection? Like event-1 updates the db with a :expensive-calc/thinking?
and dispatches further to event-2 which is debounced and does the calculation? Or am I misunderstanding something?
@madstap yea that is a good solution, and normally i would do that. The only problem is there are a number of events that can trigger changes to the basis for an expensive calculation, so then I think it makes sense to "react" to those changes, instead of spreading the logic around many handlers, or applying a global interceptor
Hey all. Everywhere I use h-box
or well boxes in general I get the following warning: Warning: Every element in a seq should have a unique :key:
@petr it's to do with the way react keeps track of elements. When you generate the items in your vector add ^{:key <unique-id>}
before each one
@sandbags thats going to get kinda ugly. Basically I’m iterating over api-responses. Woudl a good time to do it be when adding it to my db atom?
@petr: there is another way to do that if you aren't expecting a lot of changes to the data - I believe you use into
, I'll try and find the doc for it. It avoids the need for the unique ID.
@shaun-mahood that’s be great!
@sandbags so it’s everywhere that there is a new element? be it a boarder/title/box/whatever?
@petr no, everywhere that there is a collection, list items, rows, a series of divs etc...
without id's react would have to compare all the elements to see which ones had been added/removed
@petr: I can't find the docs right now, I'm pretty sure it's in the re-frame docs somewhere - it was one of the docs that crossed over between re-frame and reagent so it may have ended up in a weird place.
Either way, the essential thing is that if you call a sequence using for
, then you will have to add the unique keys. If you use into []
, then you don't have to worry about it.
The reasoning behind the keys can be found at https://facebook.github.io/react/docs/lists-and-keys.html#keys - my understanding as it relates to reagent is that if you are moving things around (dragging items in a list, for example) then you should see better performance, but otherwise you can just use into []
and avoid the whole mess.
@sandbags: Well, if I could find the relevant docs then that would explain it better 🙂
Oh perfect, didn't even have to light up the batsignal!
Looks like mapv is an issue based on the bottom of that answer, assuming that hasn't changed