Open eneroth opened 3 years ago
This looks to be a bug. The fix might be as simple as extending the ImplicitNav protocol to MetaFn
like is done already to function
. You should be able to try doing that in your own project and see if it fixes it.
I have the same error, doing basically the same thing (trying to replace all keyword values within an arbitrarily nested structure. I'm working in CLJC, and it works on the CLJ side but not the CLJS.
This looks to be a bug. The fix might be as simple as extending the ImplicitNav protocol to
MetaFn
like is done already tofunction
. You should be able to try doing that in your own project and see if it fixes it.
I have searched in vain for the example you are talking about, in which the implicitnav function is extended. Can you link where that is done, @nathanmarz ?
I'm a newbie to programming with protocols and types, so feel pretty clumsy. I can't locate a definition of pred
in this, and have scoured the namespace without success:
(extend-type #?(:clj clojure.lang.AFn :cljs cljs.core/MetaFn)
com.rpl.specter.protocols/ImplicitNav
(implicit-nav [this] (pred this)))
adding the following did indeed fix the issue, so my function now works in both clj and cljs:
(ns foo
(:require [com.rpl.specter :as s]
[com.rpl.specter.protocols]))
(extend-type #?(:clj clojure.lang.AFn :cljs cljs.core/MetaFn)
com.rpl.specter.protocols/ImplicitNav
(implicit-nav [this] (s/pred this)))
Got the following error in CLJS when the path wasn't in a vector version 1.1.4
.
Thought I'd report it as it's not very clojurey to care that it isn't a vector, but was easily fixed in project code.
#error {:message "Not a navigator",
:data {:this
(:my/cool
"key"),
:type-str "cljs.core/Cons"}}
I'm trying to write a function to replace all instances of a value in a data structure with another value.
Specter is black magic to me, so I started from an example and ended up with this:
It works as I expect in Clojure,
Yields,
However, in ClojureScript, I get
I thought my data structures in ClojureScript contained something surprising, but it's the case for this as well:
Am I doing something weird in the above function?