Fork me on GitHub
Mor Gazith08:05:03

hey, is someone here using intellij/cursive for re-frame and knows if it’s possible to make command+click go to definition of an event? i.e. have cursive understand something like [::a.e/log-event …] and jump to where :log-event was defined


Yes, Cursive has been aware of re-frame for some time now. But you have to use reg-event-* functions that are provided by re-frame - you cannot use any wrappers around them.

Mor Gazith08:05:54

so for example i have this at

  fn [] ...)
and at some other file:
(ns ...
    (:require [ :as a.e]))
   (fn [...]
       {:dispatch [::a.e/log-event :something]}))

Mor Gazith08:05:21

when i cmd+click on ::a.e/log-event it does nothing


That's strange - something very similar works for me. Can you ask it in #cursive ?


re is re-frame.core, right?

Mor Gazith08:05:34

ooohhh…. good catch, no it’s a wrapper :face_palm:

Mor Gazith08:05:10

yeah, you’re right, changing it to

(re-frame.core/reg-event-fx ...)
seems to work


Yeah, I suffer in the same way. :) Colin has promised that there's something planned in this regard, IIRC.

Mor Gazith08:05:19

thanks for the help

👍 4

does it work only for reg-event-fx ? what about reg-fx or reg-sub ?


Didn't check reg-fx. Works for all event and sub functions for me.

Mor Gazith08:05:12

works for reg-fx as well (when i use re-frame.core directly, without a wrapper)


yeah for some reason even reg-event-fx doesn't work for me


will try to figure out why later


oh right it works only for namespaced keywords 🙂


Howdy all, I'm trying to fetch some data from an api and I keep getting a CORS error. Hoping someone here can help me 🙂 This is the error: Cross-Origin Request Blocked: The Same Origin Policy disallows reading the remote resource at . (Reason: CORS header 'Access-Control-Allow-Origin' missing)


It's not re-frame-related at all. The error is pretty self-explanatory, you just need to know some "what"s and "why"s about CORS:


Ah I see, the API isn't sending the response with an 'Access-Control-Allow-Origin' header Do you know of an easy way to bypass this just for dev that doesn't require me going back and modifying the API?


There's a client, there's a server, and there's a connection between them. 3 components, so 3 ways to fix the issue: 1. Change the client, i.e. the web browser you're using. Obviously should be avoided 2. Change the server. A preferred solution assuming that the same code will be used in production 3. Change the connection. I.e. plug into it a proxy that sets that header for you. A bit of a hassle to set up but may be fine for development


Okay, fair enough. I'll go and modify the api, thanks for you help

👍 4

Hi. I run my clojure-script code with shadow-cljs when ever there is a bug in the code (especially functions for view) the page completely goes out (I get a white blank page) and some error pops up on the console Is there any method to avoid losing the whole page despite of the exceptions thrown on different parts of the code? In other words what are the best practices for this kind exception handling for these situation? Thanks.


error boundaries


Thanks alot.