Fork me on GitHub
#re-frame
<
2018-08-06
>
ingesol10:08:10

In case someone's interested, I extracted the event chain feature of kee-frame into a separate lib, here https://github.com/ingesolvoll/re-chain (sorry for the lame names, I can't be bothered to be more creative).

👍 16
Sen12:08:54

I'm buiding an app on top of https://github.com/Day8/re-frame-template, I got to the point where I want to write some tests, so the ReadMe says I should install phatomjs to run doo, however, phantomJS is deprecated in favor of phantomjs-prebuilt.

Sen12:08:32

I know I can use other JS envs but just wonder should the ReadMe be updated

gadfly36115:08:54

@armikhalev yeah, the readme should be updated. You are welcome to open an issue! :)

Sen15:08:27

Ok, cool!

Wilson Velez16:08:27

Hi, which datepicker do you recommend for a very basic re-frame page?

p-himik18:08:44

I used the one from re-com, but the last time I checked it had some minor issues, like changing its margin when you open the pop-up. Maybe they're fixed now, IDK.

kurt-o-sys19:08:00

I'm using ["react-flatpickr" :default Flatpickr]

kurt-o-sys19:08:50

I want to use a react component with re-frame, and I seem to fail to make the dispatch function work. It works fine with reagent/atoms, but I want to use the re-frame db:

(defn choose-datetime [read-val set-val]
  (let [value @read-val]
    [:> Flatpickr {:options  (clj->js {...})
                   :value    value
                   :onChange (fn [selected-dates _ _]
                               (-> selected-dates
                                   ...
                                   set-val))}]))
so, the args of the function are read-val: (re-frame/subscribe ...) set-val: #(re-frame/dispatch ...)

kurt-o-sys19:08:26

when I add printlns to the dispatch function, I can see them logged in the console, however, the value is not(!) updated.

kurt-o-sys19:08:21

[choose-datetime
                               (re-frame/subscribe [...])
                               #(re-frame/dispatch [... %])]

kurt-o-sys19:08:34

I seem to be missing something... what am I doing wrong?

kurt-o-sys19:08:36

oh, or it could be just https://github.com/Day8/re-frame-10x not showing the changes...??

manutter5120:08:49

That sounds like something I’ve seen and fixed by adding a modified key to the component. I think this is how you alert React to the fact that it has changed, as in ^{:key (str "foo-" current-val)}[my-component ...]

genekim21:08:33

Slightly off topic, but I’m hoping someone here can help? I’m embarrassed about this newbie question — but I just upgraded to ClojureScript 1.10.339, but I’m now getting a bunch of type inference errors for functions like GetElementById and preventDefault. Many moons ago, I added to certain namespaces (set! *warn-on-infer* true) to detect extern errors (things that would get minimized away by the Closure compiler). What is the best way to correct my code so that these warnings go away?

Cannot resolve property getElementById for inferred type js/HTMLDocument in expression

Ex: (.getElementById js/document "app")

Cannot infer target type in expression (. event preventDefault)

Ex: (.preventDefault event)
I added the JS signatures from inferred_externs.js, and copied them into my externs.js file, which include:
Object.document.getElementById;
HTMLDocument.prototype.getElementById;
document.getElementById;
Object.preventDefault;
(I see getElementById and preventDefault being used all the time like the above — is there a different way that I’m supposed to use them now?) Many thanks in advance!

isak22:08:52

@genekim Not sure if it will help in this particular case, but here is a macro that helps sometimes: https://github.com/reagent-project/reagent/blob/master/src/reagent/interop.clj#L25-L43

piotr-yuxuan23:08:27

Reagent in unfamiliar environment : render React component in a Jekyll static website https://github.com/piotr-yuxuan/re-frame-and-jekyll/blob/master/src/re_frame_and_jekyll/core.cljs I would be super interested in any criticism, feedback, or opinionated ideas about that.