Fork me on GitHub
#clojurescript
<
2019-07-05
>
Pick Feky01:07:18

is there any way to wrap CORS to compojure-api ? i tried wrap-cors from ring-cors lib and seems didnt work.

Pick Feky01:07:19

oops this is cljs sorry

Schmoho14:07:09

I have one issue left with Cider/Figwheel that bothers me and I can't seem to find a solution googling for it, maybe someone can help me. When I start a Figwheel-REPL via Cider it does not open the page in the browser - and that leads to an nrepl sync request timeout unless I nil that variable. And then I still need to manually open the page after an unknown amount of time. Does anyone know what to do about that? The Cider-Docs for CLJS explicitly state "open a browser and go to the figwheel url", so it kind of seems like this is expected behaviour.

Schmoho14:07:20

Okay, it says the same in the figwheel wiki. But I'd guess there must be something like a hook after Cider-REPL-initialization and a way for Emacs to open a tab in the browser ...

lilactown16:07:57

in the latest CIDER, when I run cider-jack-in-clojurescript it does ask if I want to open a browser window

lilactown16:07:11

(I only use shadow-cljs and fighweel-main tho, not lein-figwheel)

Mario C.16:07:34

I am using Om and I've encountered quite a peculiar case. I had a component that wraps a reify such as (defn funny-view [funnies owner] (let [...] ... (reify om/IRenderState (render-state [...]...). Inside the let I had a list [my-list-of-jokes [:j1 :j2]] and whenever I changed the state in the parent component, the list would replicate [:j1 :j2 :j1 :j2]. I added some println's as sanity checks in the let and I noticed that they would output many times but println's in the render function would output the expected number of times. The replication would only occur once after initial page load and first update then after it would not happen. I know this was occurring because of the let wrapping and after moving that logic into the init-state everything works as it should. I am just curious on the why it was happening. Any ideas?

dnolen16:07:22

@mario.cordova.862 there's an Om specific channel btw

Mario C.16:07:36

You're right I should probably post it there

tianshu19:07:18

sometimes when there'll be a warning like can't take the value of macro cljs.core/and or can't take the value of macro cljs.core/or if I write something like this:

(when (or x y)  ;; x and y come from arguments
   ....)

tianshu19:07:47

If I write when (or (some? x) (some? y)), there will be no warning

dnolen19:07:44

that sounds like a bug - more info needed

tianshu19:07:09

I'm still trying to find the minimal case for reproducing

dpsutton19:07:11

are you experiencing this with figwheel-main?

tianshu19:07:38

yes, with figwheel-main and devcards

dpsutton19:07:56

i believe there's a bug in figwheel-main that is patched but perhaps not released yet?

dpsutton19:07:52

can go to a snapshot version of figwheel-main or downgrade cljs: https://github.com/bhauman/figwheel-main/issues/165

tianshu19:07:48

looks like I can require a snapshot version of figwheel-core

dpsutton19:07:21

i wonder if @bhauman is around and could cut a release? this has come up a bit in the past is the only reason i recognized it

tianshu19:07:56

oh, no, I found my figwheel-main isn't the newest version.

tianshu19:07:21

let me switch to 0.2.1. I think this may be resolved already

tianshu19:07:57

@dpsutton thanks for help!

parens 4
Mikko Koski19:07:43

Is there a way in ClojureScript to control the reader so that it would read the decimal types to something else than JavaScript number? Something like (cljs.reader/read-string "{:a 1.01M}") => {:a [:decimal "1.01"]}?

dnolen20:07:54

custom reading is not really supported in Clojure and thus not supported in ClojureScript

dnolen20:07:37

you can of course probably hack around and figure out how to make it work - but there is not official / sanctioned way - and there won't be

Mikko Koski20:07:00

Ok cool. Thanks

samedhi22:07:30

I am attempting to test using lein doo nashorn test. I have a dependency to Firebase which I satisfy in the browser by simply importing the Firebase <script> within my index.html before running my compiled test.js script. However, in Nashorn the index.html is not being read from (it only runs a javascript file). I was wondering if there is a way to grab the Firebase script before running my test script in Nashorn?

samedhi22:07:26

I guess I could also wget all the scripts I need, and then concat them to the front of my test.js script... Seems dubious.

samedhi22:07:04

You know, maybe this is dumb, maybe I should just run javascript test from within my browser, seems odd not to have the immediate feedback on the cli though...

lilactown22:07:34

there are two ways to go about executing tests in a browser

lilactown22:07:43

you can use a build that executes a specific runner ns to give you immediate feedback. I like using that in conjunction with https://github.com/bhauman/cljs-test-display

lilactown22:07:57

I think both figwheel and shadow-cljs have some amount of automation around setting that up

lilactown22:07:41

you can also use something like karma, which will execute your tests in a headless environment and give you output via the CLI. we use this for CI purposes

lilactown22:07:10

not sure how to set that up for figwheel, but shadow-cljs has a build target specifically for that

samedhi22:07:49

Thanks. So I also tried Karma, but the error messages are less than great so far. I mean they are there, but there is so much noise about the browser and all that, feels like it might only be appropriate for actual integration, not for allowing me to develop against it.

samedhi22:07:34

I will look at cljs-test-display.

samedhi22:07:12

Finally, is shadow-cljs over-reaching for this problem? I kind of though shadow-cljs was for integrating external javascript that just wasn't going to play very well with the Clojurescript compilation process? My knowledge of this is light, so could be entirely wrong.

lilactown22:07:13

shadow-cljs is a general purpose build tool for clojurescript

lilactown22:07:25

it does what a combination of leiningen and figwheel and clojurescript, or deps.edn and Clojure CLI and figwheel and clojurescript, do

samedhi22:07:41

Hah, that sounds like a lot, I take it you endorse using it?

lilactown22:07:44

e.g. managing dependencies, configuring builds, compiling code, hot loading changes during development

lilactown22:07:46

I like it a lot

lilactown22:07:20

I find most of my projects end up needing to do some subset of those things and knowing how to use shadow-cljs lets me do any of them

samedhi22:07:23

Ok, cool, gives me two new paths to walk down. I'll take a look. Thank you.

lilactown22:07:45

it also has the best story for integration with npm libs which I often use