This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2017-10-04
Channels
- # aleph (2)
- # beginners (80)
- # boot (18)
- # cider (6)
- # cljs-dev (14)
- # cljsrn (5)
- # clojure (114)
- # clojure-android (5)
- # clojure-dev (8)
- # clojure-greece (6)
- # clojure-italy (9)
- # clojure-russia (108)
- # clojure-uk (82)
- # clojurescript (158)
- # css (1)
- # cursive (21)
- # data-science (1)
- # datomic (66)
- # emacs (9)
- # ethereum (3)
- # fulcro (26)
- # graphql (7)
- # hoplon (25)
- # juxt (2)
- # keechma (34)
- # lein-figwheel (4)
- # leiningen (2)
- # off-topic (4)
- # om (5)
- # onyx (14)
- # parinfer (2)
- # pedestal (17)
- # planck (3)
- # portkey (14)
- # re-frame (23)
- # reagent (12)
- # ring (8)
- # rum (1)
- # shadow-cljs (506)
- # spacemacs (2)
- # vim (11)
- # yada (6)
I’m not sure I’ve found a bug, better asking people before filing a false bug report.
I’m finding that when correctly read EDN response from servers, contains custom record types, these types are lost in favor of standard maps when fulcro client dedups data into the db
@rastandy That is something that you need to fix in transit-clj and transit-cljs yourself. Fulcro uses transit and transit gives you options to add extra read and write handlers.. But I would suggest just using maps or adding a post-mutation and then change it into a record
@mitchelkuijpers edn is read correctly from the transit endpoint, the problem arises, I suppose when the om or fulcro machinery (I don’t really know) dedup the data in the app state.
So you have added custom read and write handlers?
like this for example: https://github.com/cognitect/transit-clj/blob/master/src/cognitect/transit.clj#L395
Because if I do:
`
(defn str->clj
[string]
(transit/read (reader (ByteArrayInputStream. (.getBytes string)))))
(defn clj->str
[data]
(with-open [out (ByteArrayOutputStream.)]
(let [w (om/writer out)]
(transit/write w data)
(.toString out))))
(defrecord Point [x y])
(-> (clj->str (Point. 1 2))
(str->clj))
this returns {:y 2, :x 1}
yes, I added write and read handlers, and I can see them being read and written through the wire
I have a custom fulcro.client.network/Network implementation and I can see in my response-ok function that my record types are still preserved in the response, just before passing them to the “ok” function provided by the framework
of course my transit/reader has been augment with the read and write handlers for my types
Ah ok, just wanted to make sure, they probably do a merge on a map somehow, but not really sure on the internals. I do think you can override the merge somewhere
@mitchelkuijpers right, a merge is something I should look for in the sources. Also an “into {}” call
I think you can override the default merge
I’ll take a look at that. thanks for the suggestion @mitchelkuijpers
I've found a bug in Fulcro CSS:
At the bottom of documentation it gives an example in using the Garden's selectors:
(local-rules [this] [[(garden.selectors/> :.a :$b) {:color "blue"}]])
should result in: .namespace_Component__a > .b {
I've tried this: [(garden.selectors/& :.badge-neg :$badge) {:background-color "#ce8483"}]
and the result was: .ledger_ui_root_Person__badge-neg$badge {
as you can see it incorrectly put $ where . should be
if I change it to [(garden.selectors/& :.badge-neg :.badge) {:background-color "#ce8483"}]
I get .ledger_ui_root_Person__badge-neg.badge {
which is what I expected.
from the first spec
@roklenarcic You are right, i've tried to reproduce this and it only seems to go wrong with the &
-selector. If you can make an issue for this i will look into this soon. For now you can use a work-around for this:
[:.a
[:&$b {:background-color 'blue}]]
-> .namespace_Component__a.b {...}
[:.a
[:&.b {:background-color 'blue}]]
-> .namespace_Component__a.namespace_Component__b {...}