Fork me on GitHub
#clojurescript
<
2022-05-13
>
geraldodev01:05:24

hi folks, how to please clojurescript and javascript and generate #js literal string with " inside ? The code below pleases clojure but generates throws unknow identifier caboom on js side

(js/console.log #js {"maybe identifier \"caboom\" " true})

dnolen01:05:37

I think you need two more backslashes before each backslash

👍 2
geraldodev02:05:03

That's it! Thank you @dnolen

Quentin Le Guennec14:05:31

Hello, since we updated to 1.11.4, set! on functions doesn't work anymore. It seems that it has to exactly match the arity configuration of the set'ed function, otherwise Object.keys(re_frame.core.subscribe) returns an empty array. It used to work, was that an intended change? (we use set! on library functions for debugging purposes)

dnolen15:05:44

@quentin.leguennec1 can you be more clear, set! on functions doesn't really make sense to me

dnolen15:05:08

do you mean set! to reset a var which happens to be a function?

Quentin Le Guennec11:05:18

in that specific case, re-frame.core/subscribe which maps to re_frame.core.subscribe in javascript

dnolen13:05:20

fwiw, if you are set! -ing at the REPL it should work, if you're talking about optimized fns builds (which include :advanced) this was never something that was supposed to work, and if it did work that was accident and not going to change anything here.

dnolen15:05:24

I've just released ClojureScript 1.11.51, before a bigger announce it be helpful for folks who have time to give it a try

Linus Ericsson22:05:41

I have a strange problem with citrus/rum where the args to the defc components aren't "delivered " correctly.

Linus Ericsson22:05:49

When I downgrade to cljs 1.11.4 everything works as expected.

Linus Ericsson23:05:17

The smallest example would be: (ns frontlyft.repro (:require [citrus.core :as citrus] [goog.dom :as dom] [rum.core :as rum])) (defn control [event args state] {:state (update state :number (fnil 0 inc))}) (defonce reconciler (citrus/reconciler {:state (atom {}) :controllers {:repro control} :effect-handlers {}})) (rum/defc smol-component < rum/reactive [r] [:div [:h1 "smoll life"] [:p (str (rum/react (citrus/subscription r [:repro :number])) )]]) (defn ^:export run [m] ;; (let [r reconciler]) (rum/hydrate (smol-component reconciler) (dom/getElement "app"))) where there obv is a webserver responing with a html page with an "app" tag, and running a frontlyft.repro.run({}) stacktrace Uncaught Error: Assert failed: (instance? r/Reconciler reconciler) cljs$core$IFn$_invoke$arity$3 core.cljs:117 citrus$core$subscription core.cljs:117 cljs$core$IFn$_invoke$arity$2 core.cljs:128 citrus$core$subscription core.cljs:117 smol_component repro.cljs:17 cljs$core$IFn$_invoke$arity$3 core.cljs:3941 cljs$core$IFn$_invoke$arity$2 core.cljs:3936 cljs$core$IFn$_invoke$arity$2 core.cljs:3971 cljs$core$apply core.cljs:3962 render core.cljs:208 reactive core.cljs:424 build_class core.cljs:112 React 17 rum$core$hydrate core.cljs:287 frontlyft$repro$run repro.cljs:26 <anonymous> (index):6 core.cljs:117 The assertation is: https://github.com/clj-commons/citrus/blob/master/src/citrus/core.cljs#L130 Buildscript: {:main frontlyft.repro :asset-path "/js/frontlyft/compiled/out" :output-to "cljs-resources/public/js/frontlyft/compiled/frontlyft.js" :output-dir "cljs-resources/public/js/frontlyft/compiled/out" :language-in :ecmascript-next :warnings true :language-out :no-transpile} The app starts when i replace r with reconciler (ie don't care about about the argument passed to smol-component, I assume some part of cljs has changed so that citrus (or rum) get broken. Make this could happen orthers as well..

Linus Ericsson23:05:53

I can send a whole project.clj file but not here.

dnolen23:05:06

I would report this to rum project first

dnolen23:05:12

If you want to pinpoint the commit that breaks for you that would be a good first step

dnolen23:05:49

There are not that many commits so a git bisect should be pretty quick

bhauman23:05:12

I’m getting Could not locate vendor/bridge__init.class, vendor/bridge.clj or vendor/bridge.cljc on classpath

bhauman23:05:40

when starting a project from figwheel

dnolen23:05:36

That one seems a bit odd since no one reported that and I did some basic checking, can you look inside the jar and confirm it is missing?

dnolen23:05:42

But will double check later

bhauman23:05:18

yeah I see the cljs/vendor/bridge.clj file

bhauman23:05:53

I’m using lein let me try with deps

dnolen23:05:11

Huh I didn't test with lein - but that would be odd

bhauman23:05:15

Damn same problem

bhauman23:05:34

Now I’ll look at the deps tree for strange stuff

bhauman23:05:29

Hold on I think I may be onto it. It’s probably not a problem on your end

bhauman23:05:40

Actually I’m wrong. The problem is still happening. So I guess I’ll just explore some more

dnolen23:05:22

happy to fix it up - not a surprise is something snuck through, might be cool to just dummy check w/ ClojureScript by itself too

dnolen23:05:33

clj -M -m cljs.main -co build.edn -r etc.

bhauman00:05:54

Yeah its the loading of figwheel that’s the problem.

bhauman00:05:59

Cool, I’ll look into this more in the morning.

bhauman00:05:50

{:clojure.main/message
 "Execution error (FileNotFoundException) at cljs.repl/repl* (repl.cljc:1060).\nCould not locate vendor/bridge__init.class, vendor/bridge.clj or vendor/bridge.cljc on
 classpath.\n",
 :clojure.main/triage
 {:clojure.error/class java.io.FileNotFoundException,
  :clojure.error/line 1060,
  :clojure.error/cause
  "Could not locate vendor/bridge__init.class, vendor/bridge.clj or vendor/bridge.cljc on classpath.",
  :clojure.error/symbol cljs.repl/repl*,
  :clojure.error/source "repl.cljc",
  :clojure.error/phase :execution},

bhauman00:05:24

anyway, tomorrow will be a better time for me to look at this

1
bhauman00:05:41

I’m thinking now that the relative path loading is failing for some reason and that an absolute classpath relative path may fix it

bhauman00:05:03

(clojure.core/load "vendor/bridge")

bhauman00:05:30

I just couldn’t stop working on it. I know I should but …

dnolen00:05:07

do you have a fix feel free to propose

dnolen15:05:28

a lot of the Clojure 1.11 functionality has been ported over - but also we've vendorized many dependencies to avoid some of the yucky AOT conflict problems that have been reported over the years

2
👍 19
🎉 2