Fork me on GitHub
#clojurescript
<
2015-10-16
>
viesti08:10:18

hum, has anyone had problems with cljs-ajax and IE9?

viesti08:10:46

cannot seem to make IE accept a JSON response, that is sent to the browser

viesti08:10:02

I’m using cljs-ajax’s response format handling, to extract some piece of data from the response before giving it back to the application

viesti08:10:29

bu seems that the xhrio object given to the :read function has no response text 😞

viesti08:10:40

which leads me to believe that IE ditches it somewhere

viesti08:10:47

stuff works on IE10 though

bensu10:10:17

@viesti: I would recommend you to read cljs-ajax to see what they use to handle HTTP requests. They probably use XhrIO, then go to that code and read the comments on IE support. There are usually lines that read // In IE 8 we need to cover for the lack of ...

viesti10:10:37

yep, tried to do as much, thing is that the underlying xhr thing doesn’t have any response data, it seems, so IE seems not to like the response

viesti10:10:00

also now that I said this, I realise that I’m giving too little info simple_smile

viesti10:10:10

and just hoping that someone has ran into the same thing simple_smile

viesti10:10:18

sorry for that simple_smile

jaen10:10:48

I remember something about IE not handling JSON back when I was doing Rails/JQuery. I don't remember exactly what that was, but I think it had something to do with the content type. What content type is your response?

viesti10:10:06

Here’s a snipplet scraped from tcpdump session: http://pastebin.com/raw.php?i=izYzZ6n7

jaen10:10:38

I'd try sending the reply with content type text/plain and explicitly telling cljs-ajax it's JSON with :response-type :json. That's a bit of a long shot, but worth trying I think.

thheller11:10:26

basically I have polymorphic list of things, based on their type they render components

thheller11:10:35

it all renders fine

thheller11:10:58

but if I hit +/- I get Uncaught #error {:message "No queries exist for component path (om.tutorial/RootView om.tutorial/TypeB)", :data {:type :om.next/no-queries}}

dnolen11:10:58

@thheller: first there’s an #C06DT2YSY channel simple_smile

dnolen11:10:26

I need to see something more minimal that exhibits the problem

dnolen11:10:40

too busy at the moment to evict mental cache for anything else

dnolen11:10:48

it’s probably just a bug

thheller11:10:57

can't really make it more minimal than that

thheller11:10:06

but I'm still working on understanding things

dnolen11:10:21

you can definitely make it more minimal

dnolen11:10:27

most of the code in that file is irrelevant

thheller11:10:28

might be best to just sort that out in render

thheller11:10:37

instead of different components

dnolen11:10:43

I won’t look at anything on this issue more than 20-30 lines

dnolen11:10:49

that’s all that it should take to repro

thheller11:10:09

you probably have more important stuff to do, will try to figure it out

thheller11:10:31

is probably the issue as I don't know how to properly set up the subquery (like the tutorial does)

thheller11:10:22

ah om#421 might be related

grounded_sage12:10:16

@dnolen: what is your stance/opinion on microservices?

dnolen12:10:52

@grounded_sage: I don’t have a stance or an opinion

dnolen12:10:15

or just not a strong one. they seem useful when operating at scale.

pupeno12:10:29

I have a function defined like this:

pupeno12:10:36

(defn add-alert [db type message]
  (s/validate (s/enum :success :info :warning :danger) type)

pupeno12:10:51

Is there a better way of providing that contract?

grounded_sage12:10:34

Cool. Was just wondering whether it is something I should look into as I learn. But doesn't seem like something that needs to be there from the start

hmadelaine12:10:02

Hi @pupeno you coud use

(s/defn add-alert ^:always-validate  my-function  [db type :- (s/enum :success :info :warning :danger) message]   … )

pupeno13:10:23

hmadelaine: thanks. I forgot about always-validate.

bensu13:10:57

I'm adding some bits of context to the Compiler Options https://github.com/clojure/clojurescript/wiki/Compiler-Options and I notice that both resources/assets and resources/public are used in the example. I think they should be consistent (if possible). Which one is preferred?

dnolen13:10:39

@bensu: the later, more consistent with Java conventions

bensu14:10:00

@dnolen: ok, resources/public it is. Thanks

thheller14:10:38

hmm I wish people would stop using resources for compiled output

thheller14:10:49

well mostly affect library authors, its probably fine for projects

thheller14:10:54

but stuff like this happens

thheller14:10:28

people do lein uberjar and package a bajillion things that should not be in there 😛

thheller14:10:00

doesn't happen too frequently but probably isn't what most people intend to do

thheller14:10:15

using resources kinda hides this

bensu14:10:51

hmm I'll think about. I guess the reason to do it is that it makes :optimizations :none work out of the box

thheller14:10:54

also that is mostly an issue for me 😉

dnolen14:10:07

docs should be consistent about resources, peoples trouble with the classpath notwithstanding.

bensu14:10:13

@dnolen: they are now simple_smile (at least in Compiler Options)

dnolen14:10:51

cool thanks

bensu14:10:41

the problem with compiler opts is that while it is correct, it generally lacks context and people misunderstand it. I guess it should stay as a reference while people should be expected to read other tutorial-like-material like the QuickStart where the context is

thomasdeutsch17:10:43

would like to switch my sass compilation from node.js to figwheel. To be honest - i would like skip the huge overhead that comes with Stuart Sierra's component library to get my first environment up. has anyone a working figwheel.clj i can steal?

thomasdeutsch18:10:42

@spinningtopsofdoom: yes, i use this config at the moment, but would like to have the additional config for a sass->css compilation. it will look something like this: https://github.com/bhauman/lein-figwheel#scripting-with-component

dnolen18:10:43

@thomasdeutsch: I would just use component for this, what are you saving by not using component?

sander18:10:37

thomasdeutsch: that script basically just runs ra/start-figwheel! and ra/cljs-repl, you can add a custom start-sass-compilation! function in the same way, with or without using component

thomasdeutsch18:10:40

yes, i would like to use component for this simple_smile but has anyone done this before? i do dont know anything about jetty and would love to just get started with a sample config

sander18:10:18

@thomasdeutsch: jetty is a web server that you may or may not want to use in your own script

sander18:10:59

if you leave out jetty, the scripts doesn't do much more than the example script before that on the same page

thomasdeutsch18:10:02

can i use... for example ... my existing node.js server?

sander18:10:05

except for easier (re)starting

sander18:10:43

@thomasdeutsch: yeah, just add a function call that starts the node process

thomasdeutsch18:10:17

and a handler - i guess... ok... i will kill some thime with this simple_smile

sander18:10:23

(.start (Thread. #(clojure.java.shell/sh "node" "server.js"))) could be a first attempt, you'll want logging and maybe restarting as well

bensu18:10:18

@thomasdeutsch: if you want to start a node server from the command line, I've been recently doing that to wrap Karma (the test runner). relevant code here: https://github.com/bensu/doo/blob/master/library/src/doo/shell.clj

bensu18:10:43

it has utils to print the output as it is running and cleanup after shutdown

bensu18:10:58

if it looks relevant to you, ping me for questions

thomasdeutsch18:10:01

lets say i would start my node.js server manually .. or it is always running in my batcave - i think i only need to add a system dev and a handler... thanks @bensu i will look into it

emil0r20:10:50

is it advisable to separate a cljs SPA with a clojure backend into two different projects?

sander20:10:26

emil0r: i wouldn't, makes it more of a hassle to share code

emil0r20:10:41

ok. thanks simple_smile

bhauman20:10:51

@shaunlebron: want to way in on what a default cljs-build config file should be named?

bhauman20:10:18

In fact I'm looking for feedback from whoever has interest.

bhauman20:10:50

We could call the file cljs-build.edn?

bensu21:10:21

boot-cljs follows a convention, something like build-name.cljs.edn

lobo21:10:04

bhauman: i'm trying to use figwheel-sidecar 0.4.1 with chrome 46 for the latest om-next tutorial and it seems lke figwheel is not recompiling nor reloading the browser. i've also tried it on FF

bhauman21:10:08

@lobo: are you new to figwheel?

bhauman21:10:25

I just tested it in 46 and its working fine

dnolen21:10:55

@lobo you may want to isolate this from the Om tutorial and make sure you can get Figwheel working on it’s own

dnolen21:10:10

@lobo a bunch of people have gone through the tutorial today and haven’t reported problems

lobo21:10:42

dnolen: sorry stupid user error most likely

lobo21:10:59

i created core.cljs in resources/... directory instead of src

lobo21:10:06

apologies 😞

dnolen21:10:07

@lobo doubtful, if you’re not familiar with all the pieces it’s easy to make a mistake

dnolen21:10:11

happens to me all the time

dnolen21:10:23

just pointing out that I’m relatively confident that the tutorial works

lobo21:10:53

@dnolen: thanx for the help. moving the core.cljs file to the right directory got things working again.

dnolen21:10:37

@bhauman @cfleming using Figwheel w/ Cursive for our two day training simple_smile

dnolen21:10:38

wish us luck

dnolen21:10:20

@bhauman: I noticed when I’m pretty printing with a Figwheel REPL I get the expected behavior but I also get noise, a second printing of stuff in a seq

dnolen21:10:39

only happens with pprint

bhauman21:10:59

@dnolen: sweet! and yeah I'm sure there is something there.

steve21:10:15

Looking for some Clojurescript/Om help...

dnolen21:10:28

@steve there is an #C06DT2YSY channel, it’s pretty busy right now simple_smile

bhauman21:10:45

wait there's an om channel?

steve21:10:00

(heading over there)

bhauman21:10:14

figwheel 0.5.0 (in process) has been a huge effort ... a big refactor into separate concerns and composing it of stuart's components. It's the "wow people are really going to be using this software for a while" refactor.

dnolen21:10:34

@bhauman: yeah someone made it a while back, it’s been a bit quiet but I’ve been more active as of late since Om Next has now left the nest

lobo22:10:36

@dnolen: a quick fix on the tutorial. I had to do:

lobo22:10:48

(om.next/from-history om-tutorial.core/reconciler #uuid "c4cee9c6-0e68-4724-a552-29c9dd26299e")

lobo22:10:02

for the uuid of history section

lobo22:10:50

and also

lobo22:10:50

(om.next/transact! om-tutorial.core/reconciler '[(increment)])

richiardiandrea23:10:26

hello guys, I am working with cljs and testing harness as such:

clojure :figwheel {:on-jsload "launcher.test/run" ... 
and
clojure
(defn ^:export run
  []
  (run-all-tests #"^cljs.*-test")
  success)

richiardiandrea23:10:02

but I can't see the failure in the dev console, only the report (e.g.: Ran 11 tests containing 17 assertions.)

richiardiandrea23:10:32

am I missing something? shouldn't it print everything to console?

shaunlebron23:10:05

@bhauman: naming is hard! cljs-build.edn is fine with me

bensu23:10:04

@richiardiandrea: are you defining your own reporting functions? Are you sure the tests are failing?

bensu23:10:09

ohh and what is success?

richiardiandrea23:10:42

I am investigating, maybe it is just that I cannot see it because of the huge amount of log in the dev console 😄

richiardiandrea23:10:50

jakemcc/lein-test-refresh does not work with cljs right?

bensu23:10:03

I don't think so. Are you looking for a way of running cljs tests and see the results in the console?

bensu23:10:11

if you want to get the output of the tests, you can always use (def cljs.test/report [:cljs.test/default :end-run-tests] [m] (cljs.test/successful? m))

bensu23:10:59

that will register a reporting function that gets called at the end of run-tests, where you can find out if the tests where succesful with cljs.test/succesful?

bensu23:10:14

instead of always saying (def success 0)

richiardiandrea23:10:37

right, I think your approach is better, even for async tests..

richiardiandrea23:10:57

I read that part of th wiki, and I am going to do it

richiardiandrea23:10:21

btw the failures are there, I just need to log less stuff and pay more attention 😄

bensu23:10:54

haha, I would dare to say it is the only way. I had to put it in the compiler to get doo working

richiardiandrea23:10:31

will check

doo
source then

richiardiandrea23:10:58

damn backticks, I am so used to Markdown I cannot stop putting three 😄