Fork me on GitHub

Can't take value of macro cljs.core/or How to fix it?


and why this issue?


Doest it mean I can’t use or with re-frame/subscribe values?


(some identity [logged? sign-up?]) can be a solution


anyway I changed logic to not use or, but it is interesting issue


@kwladyka that appears to be a bug in figwheel. others have reported the same with and. apparantely this fixes it

👍 5
🍻 5
eccentric J19:02:11

When using reagent, I have a component that needs to listen to keyboard events on the document when mounted. Is there an example, guide, or sample for how to best handle that?

Daw-Ran Liou19:02:22

Beginner question here: when I create a javascript object, e.g. (react/createContext "hi"), from my repl, why do I get nil back in the repl? However, I can also find the js object show up in the browser console. Is this the right behavior or did I mess up something? Thanks.

workshop.core> (react/createContext "hi")

Daw-Ran Liou19:02:07

BTW I’m using shadow-cljs as my cljs repl. Not sure if this is relevant.

eccentric J19:02:40

When invoked from the console in vanilla js does it return an object or is it a side-effect?

Daw-Ran Liou19:02:12

It returns an object:

Object { "$$typeof": Symbol(react.context), _calculateChangedBits: null, _currentValue: undefined, _currentValue2: undefined, _threadCount: 0, Provider: {…}, Consumer: {…}, _currentRenderer: null, _currentRenderer2: null }


@dawranliou what’s happening is the CLJS printer is barfing on the Symbol(react.context) JS value


if you check the browser console you should see an error pertaining to it


you can fix it using these 4 lines:

(extend-protocol IPrintWithWriter
  (-pr-writer [sym writer _]
    (-write writer (str "\"" (.toString sym) "\""))))

Daw-Ran Liou20:02:43

Thanks @lilactown ! This is very useful. I need this in all my cljs project now


@dpsutton So... I finally got it working. But what I found does also not make not much sense to me. It seems that it has something todo with Gnome. Every distro that uses a Gnome desktop did not give me the repl prompt after a reboot. But if I used KDE or XFCE it works alright.


hmm. that is bizarre to me. there's something funky going on. but no idea