Fork me on GitHub
#clojurescript
<
2016-07-21
>
dominicm11:07:51

@bhauman: I've discovered something a little strange with Figwheel, and it's why Vim-Fireplace was breaking. When figwheel is started within a session, and given an id, (e.g. 'abc123'). When figwheel is told to do (println 1) with an id of 'def456' it writes the *out* to 'abc123', not 'def456'. This behaviour is different than that of boot-cljs-repl and "normal" nrepl. I can have a go at digging into this, but I wanted to know your opinion first. --- I have a python script which can demonstrate the issue, but it needs a little refining first.

bhauman12:07:31

here is where I ensure that I am printing on the same thread that started the repl

bhauman12:07:02

there is another sticky bit here

bhauman12:07:22

I'm overriding eval so that I can catch and print warnings and exceptions

dominicm13:07:14

I should clarify my wording, that the session != the id. I didn't make that clear.

rohit14:07:28

@nnbosko: have you checked if the dropdown plugin is loaded?

Nicolas Boskovic14:07:51

It is; I'm able to interact with the dropdown

Nicolas Boskovic14:07:11

However the functionality isn't working

rohit14:07:57

@nnbosko: i don’t know enough about semantic ui to be able to help. here’s a suggestion: try to reproduce the issue in minimal amount of code without reagent etc.

dominicm17:07:14

@bhauman: Looking through the tools.nrepl and your code: The out binding changes between requests normally. Because you sit on the same thread, you don't have the new out being set for that id. This is why figwheel is not working with ids, I think. I'm not sure how to solve this exactly, maybe the channel should pass around the current out for processing.

dominicm17:07:51

Ah, I think you acknowledge this limitation in your code. "One repl at a time"

bhauman17:07:22

@dominicm: Darn I thought I was being so clever

dominicm17:07:13

It is an easy part of the spec to miss 😃 it took me some hunting to find it, and it was the last thing I thought to try.

bhauman17:07:53

I can fix it ... it will be ugly though

bhauman17:07:17

since we really can't change the api in the short term

bhauman17:07:29

I will have to capture the *out* when evaluate is called and use it for any output that comes back from the client

bhauman17:07:50

@dominicm: so this has worked for me quite a while, so in my workflow using nrepl and cider there is a stable output stream, why are you getting a new output stream on every request?

dominicm17:07:19

@bhauman: This was the design that fireplace selected. I think the id was designed for synchronous workflows like those imposed on vim. I think cider has an alternative, where it does a persistent streaming. I only learned this recently, and may be false. An alternative use case would be where a client wants to know the output of only the code evaluated.

bhauman17:07:57

That alternative case works, already

bhauman17:07:10

but I'm down for the change

bhauman17:07:33

it won't affect folks who have a stable out

dominicm17:07:09

Hmm, tools.nrepl suggested ids were the way to do the alternative case. You may have multiple async threads running in the same session, but with different ids. You can use the id to filter the responses.

dominicm18:07:45

Perhaps I misunderstand though

bhauman18:07:40

snapshot is deployed

dominicm18:07:50

@bhauman: I will try it tomorrow, that was fast!

bhauman18:07:28

I just fixed it because it was obvious and if I put it off I would have forgotten the particulars

juhoteperi19:07:18

@bhauman: Looks like that fix didn't work or there is another problem. We'll continue investigating.

mattsfrey20:07:26

wondering what tools people are using currently for unit testing / integration testing using cljs and a react wrapper like om or reagent?

shaun-mahood20:07:59

@mattsfrey: I'm pretty much using devcards for all my testing now

verma20:07:17

@mattsfrey: I’ve used clj-webdriver with reasonable success in the past along with devcards for tests and simple UI prototyping. https://github.com/semperos/clj-webdriver

mattsfrey20:07:36

first time hearing about devcards, looks really interesting

verma20:07:52

its awesome! :thumbsup:

jkrasnay20:07:19

I’ve set up Figwheel to run all my cljs unit tests upon reload. Output goes to the browser console

mattsfrey20:07:08

@jkrasnay: what libs do you do the unit tests with?

jkrasnay20:07:36

Just cljs.test

mattsfrey20:07:44

oh no kidding

jkrasnay20:07:08

In my cljs main, when I call figwheel.client/watch-and-reload I set :jsload-callback to call cljs.test/run-all-tests. Works well, though I don’t have a huge number of tests yet.

dominicm20:07:46

@bhauman: Seeing this:

>>  {'code': '(println :second-message-5)', 'op': 'eval', 'id': 'prefix-1469082218-5', 'session': 'd23b0b41-3393-4f10-95ec-79a8e6cfba85'}
<<  [{}, 'id', 'prefix-1469082218-4', 'repl-type', 'clj', 'session', 'd23b0b41-3393-4f10-95ec-79a8e6cfba85', 'status', ['state'], None, {'out': ':second-message-5\n', 'id': 'prefix-1469082218-3', 'session': 'd23b0b41-3393-4f10-95ec-79a8e6cfba85'}, {'ns': 'cljs.user', 'value': 'nil', 'id': 'prefix-1469082218-5', 'session': 'd23b0b41-3393-4f10-95ec-79a8e6cfba85'}, {'status': ['done'], 'id': 'prefix-1469082218-5', 'session': 'd23b0b41-3393-4f10-95ec-79a8e6cfba85'}]
Where the session d23b0b41-3393-4f10-95ec-79a8e6cfba85 was created in id prefix-1469082218-3 and was where I originally ran the figwheel/cljs-repl code.

dominicm20:07:15

Not sure why it's struggling to parse the first map, probably something I'm doing.

dominicm20:07:01

I'll debug deeper tomorrow. I'll try update first thing if you've figured something more out.