This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2022-11-16
Channels
- # announcements (7)
- # babashka (8)
- # beginners (48)
- # calva (4)
- # cider (6)
- # circleci (2)
- # clj-commons (14)
- # clj-kondo (3)
- # clj-on-windows (7)
- # cljs-dev (34)
- # clojure (49)
- # clojure-dev (25)
- # clojure-europe (48)
- # clojure-losangeles (1)
- # clojure-nl (4)
- # clojure-norway (33)
- # clojure-uk (2)
- # clojurescript (37)
- # community-development (5)
- # conjure (17)
- # cursive (2)
- # data-science (1)
- # editors (10)
- # emacs (50)
- # events (22)
- # honeysql (11)
- # introduce-yourself (1)
- # jobs-discuss (13)
- # lsp (42)
- # malli (9)
- # off-topic (7)
- # pathom (11)
- # portal (5)
- # re-frame (3)
- # reagent (22)
- # reitit (8)
- # reveal (1)
- # rewrite-clj (4)
- # shadow-cljs (38)
- # xtdb (21)
I'm getting errors like `cljs.core/<, all arguments must be numbers, got [#{nil clj-nil} number] instead` , as a starting point, what is a [#{nil clj-nil} number]?
err that's probably just a vector?
what is a clj-nil then?
i guess it's not important, in that it's not a number...
Github search is not great. But looking through https://github.com/clojure/clojurescript/blob/9562ae11422243e0648a12c39e7c990ef3f94260/src/main/clojure/cljs/analyzer.cljc, I get the impression maybe clj-nil
is a symbol that internally represents the combination of null and undefined?
Found this, which definitely seems relevant to your query. Seems that since 1.10.741, it is in fact "not a number". 😄
> from Changelog for v1.10.741
> • CLJS-3086: Switch clj-nil to not be considered a numeric type
Looks like you have (a vector of (a set of nil and clj-nil) and a number)
. Don't know if spelling that out explicitly helps you any with figuring what went wrong.
thanks, yeah that helps at least i know what i'm looking at.
[#{nil clj-nil} number]
is the types of the arguments, so you gave a #{nil clj-nil}
as first argument (probably after calling a function) and a number
as of second.
Hello, I am having this error and I can’t figure out where it comes from. Most likely it’s from something I am doing, but I find no references to my code in the trace, only ClojureScript and reagent. The behaviour is super weird as well. It happens after the first load when I search for the first time (in the search bar I made). If I reload the page (so, same state I suppose (re-frame+shadow) and search again, it works well. I can only reproduce by closing the page, opening a new one, a searching for the first time. 🤷 Does it ring a bell to aynone?
And it comes and goes. Now, I cannot reproduce the error anymore… Probably shadow listens to Slack or something. 😛
And back again… wtf
My component looks like this if it can help:
(defn search-bar
"Search bar where the user can input its origin."
[]
(let [origin (reagent/atom nil)]
(fn []
[:div {:style {:padding "9px"}}
[:input {:type "search"
:style {:border "none" :width "100%"}
:placeholder "Paris..."
:value @origin
:on-change #(reset! origin (-> % .-target .-value))
:on-key-press #(when (-> % .-key (= "Enter"))
(>evt [:eve.events.api/search @origin {:clear true}]))}]])))
>evt
is just re-frame/dispatch
.
Yeah, there is none
There are three logs, apparently the same. The traces are then: 1. cljs.core, reagent.ratom, day8.reagent.impl.batching 2. cljs.core, reagent.ratom, day8.reagent.impl.batching 3. day8.re-frame_10x.inlined_deps.re-frame….re-frame.router
That’s a dependency I have to have a tracing interface in the browser.
My event handler is quite straightforward, I don’t see what could not be set:
(re-frame/reg-event-fx
::search
(fn [{:keys [db]} [_ stop-name & [opts]]]
(let [connections-request (query {:method :get
:uri (url (str "/connections?stop_name=" stop-name))
:on-success [::set-connections]
:on-failure [::raise-http]})
origin-request (query {:method :get
:uri (url (str "/stops?name=" stop-name))
:on-success [::set-origin]
:on-failure [::raise-http]})]
{:http-xhrio [connections-request
origin-request]
:db (let [with-search (assoc db :search/origin stop-name)]
(if (:clear opts)
(assoc with-search :origins (list))
with-search))})))
Most likely it has to do with this extension/plugin. Thanks for your answer, I was afraid I was missing something obvious. 🙂
I think I made some progress.
Actually the problem occurs after page reload too, it just appears random.
Since there are no «obvious» mistakes after investigation, I decided to poke where the more impure stuff happens, and it’s in this handler above.
Two requests are made concurrently. I tried disabling the origin-request
one, and the problem never occurs. I re-enabled it and disabled connections-request
and now the problem always occurs.
I suspect something is messy in my subscriptions and it works only in a given order of the responses.
The stack-trace was not very helpful 😅 .
Also, I noticed that the 10x reference only appeared when the panel was open on the page. So, it could not be the cause.
And here it is! I was «expecting» the «origin» response to come after the other one which is essentially building a map. I then used this map as a function in a filter. 💥 💥 💥
Hi all, Trying to setup some tests on a CLJS project using doo (https://github.com/bensu/doo) my file structure is something like: The src/ src/ ├── clj │ └── my_project │ ├── handler.clj │ └── server.clj ├── cljc │ └── my_project │ └── util.cljc └── cljs └── my_project ├── core.cljs .... The test/ test/ └── cljs └── my_project ├── core_test.cljs └── runner.cljs in the project.clj:
{:cljsbuild
{:builds
{:browser-test {:source-paths ["src/cljs" "test/cljs"]
:compiler {:output-to "out/runner.js"
:main my-project.runner
:optimizations :none}}}...
The core_test.cljs and runner.cljs:
(ns my-project.runner
(:require [doo.runner :refer-macros [doo-tests]]
[my_project.core-test]))
(doo-tests 'my_project.core-test)
(ns my-project.core-test
(:require [cljs.test :refer-macros [deftest is]]))
(deftest foo-test
(is (= 10 10)))
Trying to run with: lein doo phantom browser-test
the result:
Building ...
#error {
:cause Assert failed: Namespace my_project.core-test does not exist
(ana-api/find-ns ns)
:via
[{:type clojure.lang.ExceptionInfo
:message nil
:data #:clojure.error{:source #object[java.io.File 0x3f8bd4b1 test/cljs/my_project/runner.cljs], :line 5, :column 1, :phase :macroexpansion, :symbol cljs.test/test-ns-block}
:at [cljs.analyzer$macroexpand_1_STAR_$fn__2705 invoke analyzer.cljc 3892]}
{:type java.lang.AssertionError
:message Assert failed: Namespace my-project.core-test does not exist
(ana-api/find-ns ns)
:at [cljs.test$test_ns_block invokeStatic test.cljc 373]}]
:trace
Somethings with the source paths looks like, but cannot see the issue.. any help will be appreciated.@U05224H0W thanks for the reply, actually is correct named on my local, I just write wrongly here…