Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How can I set a nested property value in Clojurescript?

I want to set an element.style.height property from clojurescript, but this code unfortunately fails:

(set! (-> (sel1 tr :.ragslide) .-style .-height) (content-height))

(sel1 selects a DOM element, it's a macro from the Dommy library)

With the following error:

clojure.lang.ExceptionInfo: 
Assert failed: Can't set! local var or non-mutable field
(or (nil? local) (and (:field local) (or (:mutable local) (:unsynchronized-mutable local) (:volatile-mutable local)))) at line 79  {:tag :cljs/analysis-error, :file nil, :line 79, :column 7}

How can I set that property?

like image 533
Daniel Ziltener Avatar asked Oct 22 '22 03:10

Daniel Ziltener


1 Answers

Ok, wow, this seems to be really weird. It failed to work because that code was inside a core.async block which messed everything up...

like image 155
Daniel Ziltener Avatar answered Oct 25 '22 18:10

Daniel Ziltener