This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2018-05-08
Channels
- # architecture (20)
- # beginners (140)
- # cider (155)
- # cljsjs (1)
- # cljsrn (29)
- # clojure (53)
- # clojure-dev (9)
- # clojure-italy (40)
- # clojure-nl (13)
- # clojure-poland (4)
- # clojure-russia (8)
- # clojure-uk (51)
- # clojurescript (74)
- # cursive (36)
- # data-science (1)
- # datomic (3)
- # emacs (14)
- # fulcro (11)
- # graphql (2)
- # java (21)
- # javascript (2)
- # jobs (3)
- # nrepl (7)
- # off-topic (18)
- # om-next (1)
- # onyx (9)
- # portkey (8)
- # re-frame (72)
- # reagent (64)
- # reitit (4)
- # remote-jobs (1)
- # rum (1)
- # schema (1)
- # shadow-cljs (49)
- # slack-help (1)
- # spacemacs (8)
- # specter (7)
- # tools-deps (27)
- # vim (28)
@danielcompton It's a bit surprising that 10x needs .5, when in the project.clj it declares a dependency on .3 only
Thanks, I've updated the dependencies for re-frame
Because it's a provided dependency it doesn't affect which version your app gets, but I can see how it would be confusing
hah, funny. I had a “maximum call stack exceeded” in the console. turns out I made a recursive subscription by accident 😉
@timok You mean "the green bit" is entirely unresponsive to mouse clicks intended to "open up" the tree?
@mikethompson correct
Including the triangles further "into" the data structure?
Some mixup between reagent/React/re-frame/re-frame-10x versions ?
[org.clojure/clojure "1.9.0"]
[org.clojure/clojurescript "1.10.238"]
[cljsjs/react-dom "16.3.0-1"]
[cljsjs/react-dom-server "16.3.0-1"]
[cljsjs/create-react-class "15.6.2-0"]
[reagent "0.8.0"]
[reagent-utils "0.3.1"]
[re-frame "0.10.5"]
...
[day8.re-frame/re-frame-10x "0.3.3"]
0.3.3-react16
Also, should [cljsjs/create-react-class "15.6.2-0"]
be for 16
@mikethompson what do you mean? should I take it out? because there is no major version 16 available from cljsjs
I think that mixing React15 and Rect16 will cause problems.
mmh...reagent 0.8 pulls in these deps...I think I copied it from there and hardcoded it... so it's a mix there
I have users
list in my re-frame db
. whenever I load users-list
page, I have (re-frame/dispatch [:events/fetch-users]
event firing. And in there I have something like (when (not (empty? users)))....
Every time a user navigates to this page, fetch-users
is being fired, but there’s almost a second where the old data shows up, because users
list is not empty after the first fetch.
So I have two options as I can see - either reset the users list within fetch-users
event, or to add component-will-unmount
lifecycle to this component. I really don’t like using lifecycles that much in reagent / re-frame. So I was wondering how do other handle such situations? do you use lifecycle events in these situations?
create-react-class "15.6.2-0"
works for React 16
@juhoteperi thanks!
@bravilogy you could use something like here: https://github.com/jacekschae/conduit/blob/master/src/conduit/events.cljs#L111-L114
@bravilogy you could dispatch :reset
from inside of :fetch-users
- if it makes sense that “Everytime when I fetch users, sure I want to reset what was before”
@mikethompson 0.3.3-react16
unfortunately didn't do the trick
Oh the problem was about re-frame-10x "data tree" not working, the triangles not opening maps etc?
Works for me now (Reagent 0.8, 0.3.3-react16) but I'm quite sure it didn't work few days ago
@juhoteperi exactly. maybe I should hit my monitor a few times... or restart... maybe tomorrow it works. 👍
Chrome was running very slow (like it froze for 10 secs after Figwheel reload) for me few days ago so I reset Chrome profile and that seems to have made it faster
(--user-data-dir can be used to set different profile, without resetting the default profile)
@juhoteperi @nenadalm thanks!
what’s the right way to setup a subscription where I have dependently-derived data in the inputs?
that's how it's done in re-frame examples as well: https://github.com/Day8/re-frame/blob/master/examples/todomvc/src/todomvc/subs.cljs#L97
my example wasn’t very good, it’s still early here 😄 I know about this feature. What i need is more the intersection of derived state
Am I right to assume that in interceptors when I modify :db
in coeffects while event-handler does not use :db
coeffect - it means that interceptor do nothing?
@timok when you say reset did it
do you mean a lein clean
?
Something else?
ok so to re-frame my problem (see what I did there?): I have data in a graph-like shape where any given node has both dependencies and derived data whose output is sometimes a function of those dependencies
for example, {:a {:val 1} :b {:val 2} :c {:inputs [:a :b] :xform +} :d {:inputs [:c] :xform * :args [2]}}
and I’d like to be able to do (subscribe [:value-for :d])
and have it pull in the values for the input nodes as needed
part of the problem is that for my specific problem, the derived state can be expensive to compute,
is there such thing as a default header in re-frame’s http-fx
? I’d like to add an auth
token to every single http call and was wondering if this can be set once and not to repeat it over and over again
Since http-fx
is based on cljs-ajax
you might try to go with interceptors: https://github.com/JulianBirch/cljs-ajax/blob/master/docs/interceptors.md
@bravilogy this is what I use:
(def jwt-interceptor
(ai/to-interceptor {:name "JWT Token Interceptor"
:request #(-> %
(assoc-in [:headers "Authorization"] (str "Token " (uh/get-jwt-token-from-localstorage)))
(assoc :format (ajax/transit-request-format)))}))
@mattly if I understand you, the structure of your signal graph is described in data held in app-db
. reg-sub
is good for capturing a static structure. So, perhaps use reg-sub-raw
instead?
It is more flexible but less convenient
thanks, this works beautifully. I was even able to leverage my existing subscriptions and not have to deref the appdb
Has anyone used re-frisk
with re-natal
? i'm following the instructions here https://github.com/flexsurfer/re-frisk/wiki/Using-re-frisk-with-re-natal and the server starts, but the contents of the 3 panels are just a green "not connected" - is there a step missing, or is there some other action i need to take to get it all linked up? (I know there appears to be 10x support in there as well, but I’ll get to that after getting re-frisk
at least connected)
Since http-fx
is based on cljs-ajax
you might try to go with interceptors: https://github.com/JulianBirch/cljs-ajax/blob/master/docs/interceptors.md