Fork me on GitHub
#reagent
<
2017-01-15
>
davin10:01:22

@pesterhazy @emccue Thanks for the information. I did try to use a macro, but it was giving me an error (saying that environ was not found). I’m still new to Clojure, so I think there is something I’m not understanding about Clojure -> Clojurescript macros.

davin10:01:04

@pesterhazy do you have an example of the macro handy? And then how to require it in cljs?

davin10:01:15

I did this:

davin10:01:58

(defmacro cljs-env [kw]
    (env kw))

davin10:01:39

where env was required like: [environ.core :refer [env]]

davin10:01:57

And then I tried to use it:

davin10:01:46

(def base-url (cljs-env :server-url))

davin10:01:54

With a require: :require-macros [thingy.env :as env :refer [cljs-env]]

davin10:01:02

Did I miss something?

davin10:01:33

(I added the :server-url key to project.clj in each profile)

davin10:01:16

(But it doesn’t get that far, because it throws an error about referencing environ at runtime)

pesterhazy15:01:52

@davin, your example seems correct

si1415:01:25

it seems that nowadays it's possible to skip React's createElement completely in many cases (http://techblog.netflix.com/2017/01/crafting-high-performance-tv-user.html), returning plain JS objects from render() instead. do you think it may be useful for improving Reagent performance?

Oliver George23:01:07

Hello. I have a "how to subscribe in a view callback" question.

Oliver George23:01:14

I'm trying out BlueprintJS which has a nice Table component. It's virtualized so that only visible cells render which is means doing cell rendering in a callback.

Oliver George23:01:42

My callback uses the row index to fetch data via @(subscribe [:get-row idx])

Oliver George23:01:15

(really i use some limit/offset paging but that's the idea)

Oliver George23:01:44

The subscribe works and shows loading.... but doesn't refresh when the data arrives.

Oliver George23:01:59

Logically this is because the render callback happens later so reagent doesn't know the deref/sub should be watched.

Oliver George23:01:49

Is there a way I can manually associated the deref/sub with the component in the callback? Passing this through.