cursive-ide / cursive

Cursive: The IDE for beautiful Clojure code
579 stars 7 forks source link

Dependency cycle for sente.cljc #1868

Closed alexbezhan closed 5 years ago

alexbezhan commented 6 years ago

I use sente library and when I run 'Load file in REPL' I get error: Dependency cycle: sente.cljc -> sente.cljc -> sente.cljc

dependency cycle error

Here is my simplified code:

;; my.core.cljs
(ns my.core
  (:require [my.ws :as ws]))

(ws/init!)
;; my.ws.cljs
(ns my.ws
  (:require [taoensso.sente :as sente]))

(declare ws-router)
(declare channel-socket)
(declare ch-chsk)

(defn event-msg-handler [msg])

(defn init! []
  (defonce channel-socket (sente/make-channel-socket! "/chsk" {:type :auto}))

  (let [{:keys [chsk ch-recv send-fn state]} channel-socket]
    (defonce ws-router (atom nil))
    (defonce ch-chsk ch-recv)

    (let [stop-ws-router! (fn [] (when-let [stop-f @ws-router] (stop-f)))
          start-ws-router! (fn []
                             (stop-ws-router!)
                             (reset! ws-router
                                     (sente/start-client-chsk-router!
                                       ch-chsk event-msg-handler)))]
      {:start      start-ws-router!})))

The error happens when I try to load any file.

My Cursive version is 1.6.1-2017.2. I also tried the latest EAP, it also has this issue.

alexbezhan commented 6 years ago

Hm, I invalidated caches and restarted IDEA and also removed target/ dir, then everything works fine. Clearly the issue is with something being cached.

alin-posorovaschi-otm commented 5 years ago

I encountered a similar problem with clj-pdf. A dependency cycle was being reported when trying to load a file using clj-pdf ((:require [clj-pdf.core :as pdf])) into the REPL, which prevented the file from being loaded.

clj-pdf.section -> clj-pdf.section.svg -> clj-pdf.section

My Cursive version is v1.8.0-2018.3. I had to downgrade to be able to load use the IDE for development.

cursive-ide commented 5 years ago

The clj-pdf issue has been fixed in #2094. There have been a couple of issues like the original one reported here, but they've all been fixed a long time ago so I'm going to close this.