Fork me on GitHub
#clojurescript
<
2022-01-23
>
Tala Tarazi12:01:29

Hi, I'm trying to setup storybook to my re-frame template project. Can't make it really work, I get this error in storybook Couldn't find any stories in your Storybook. does anyone did this before in re-frame?

p-himik13:01:21

Just in case - I'm 95% sure it has nothing to do with re-frame. The Storybook tutorial states: > The story is a function that returns a rendered element (i.e., a component with a set of props) in a given state---exactly like a Functional Component. If that's always the case, then you definitely have to jump through some hoops to make Reagent components work with Storybook as by default they are class components and not functional ones.

p-himik13:01:25

And if that template you're using claims to have Storybook support built into it, I would create an issue in the template's issue tracker right away.

Arthur15:01:36

To be quite honest I dont think this has anything to do with re-frame either. I’d recommend checking the following links: • https://shaolang.github.io/posts/2021-02-14-storybook.js-with-shadow-cljs/https://github.com/DavidVujic/clojurescript-amplified

David Vujic15:01:43

I have made an example project combining ClojureScript and Storybook that might help: https://github.com/DavidVujic/clojurescript-amplified Have a look at the shadow-cljs.edn - I recognize the error message you get and think it might be how ClojureScript and Webpack work together.

☝️ 2
David Vujic15:01:22

Haha, as soon as I hit ENTER, your message popped up too Arthur 😄

😆 1
Arthur15:01:36

@U018VMC8T0W Looks like we were writing it at the same time haha :-)

😆 1
achikin21:01:18

Are there full, sane and up to date guides on js interop?

achikin21:01:09

I have an interop call like this (.toISODate (luxon/DateTime.now)) and I’m trying to convert it to a shorter version.

p-himik21:01:47

How would you make it shorter? There are no extra symbols that you could even potentially remove.

p-himik21:01:33

Regarding "up to date guides" - pretty sure nothing has changed since forever, so pretty much any guide should be good.

achikin21:01:36

I was thinking about some kind of threading

p-himik21:01:50

Yeah, threading will make it longer.

p-himik21:01:50

This should work, but it's of the same exact length: (.. luxon/DateTime now toIsoDate).

achikin21:01:30

That’s the issue with the guides. I’ve opened the first link from google search clojurescript js interop https://lwhorton.github.io/2018/10/20/clojurescript-interop-with-javascript.html and checked “Function invocation” section. It mentions the invocation like this (. js/document hasFocus) but not like this (js/document.hasFocus) So I wonder if there is a complete guide…

athomasoriginal22:01:44

None that I have found that I imagine match what you’re looking for (because I remember wanting the same things as well when I started!). However, I did find that https://clojure.org/reference/java_interop is more helpful than it would initially seem because the concepts carry over to ClojureScript.

p-himik22:01:51

This page is linked by the official CLJS website: https://cljs.info/cheatsheet/ It's only a cheatsheet so it doesn't go into the details, but a.b kind of access is there. Note that such kind of field access is "unofficial" (probably why it's usually not mentioned in all sorts of guides) but it's working and will continue to work.

p-himik22:01:23

Regarding Java interop - not all the concepts carry over unfortunately. In fact, when using interop to its fullest, in terms of differing lines of code there will be more differences than commonalities, just because of all #js and ^js. But depends on the project and the task at hand, of course.

1
Chase23:01:38

This one is pretty good and thorough: https://www.spacjer.com/blog/2014/09/12/clojurescript-javascript-interop/ but it also doesn't mention js/document.hasFocus as a possible way either I don't think

achikin00:01:18

Thank you, @U9J50BY4C. At least it mentions the new constructor dot syntax like (def date (js/Date.))

achikin00:01:15

@U050B88UR are there any official docs for the js interop?

henryw37415:01:20

I wrote up things about interop I didnt find sufficient docs for https://widdindustries.com/clojurescript-jsinterop/

p-himik15:01:08

That Jira link should now be https://clojure.atlassian.net/browse/CLJS-3315 since the URL format seems to have changed.

👍 1