This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2018-03-09
Channels
- # alda (5)
- # aleph (10)
- # bangalore-clj (1)
- # beginners (168)
- # cider (68)
- # cljs-dev (263)
- # clojars (4)
- # clojure (66)
- # clojure-brasil (25)
- # clojure-china (1)
- # clojure-dusseldorf (1)
- # clojure-greece (4)
- # clojure-italy (3)
- # clojure-russia (4)
- # clojure-spec (12)
- # clojure-uk (16)
- # clojurescript (36)
- # community-development (12)
- # cursive (9)
- # data-science (1)
- # datascript (8)
- # datomic (20)
- # defnpodcast (6)
- # emacs (2)
- # figwheel (2)
- # fulcro (51)
- # graphql (62)
- # immutant (14)
- # keyboards (1)
- # lein-figwheel (10)
- # leiningen (5)
- # lumo (15)
- # off-topic (4)
- # onyx (3)
- # pedestal (4)
- # portkey (13)
- # protorepl (1)
- # re-frame (8)
- # reagent (2)
- # reitit (4)
- # shadow-cljs (71)
- # spacemacs (7)
- # specter (33)
- # sql (9)
- # unrepl (75)
- # vim (7)
@tony.kay Was looking through the response middleware docs: http://book.fulcrologic.com/#_response_middleware and found a curious line there talking about merging specific errors into state. Doesn’t this conflict with the principle of only giving what has been queried?
or would i have to modify the transaction? Yeah that’s probably what needs to be done
@levitanong So, like I said, I'm not sure what I have in the docs is right. Loads have a specific story, and mutations another. So, the stuff about modifying the error stuff only works on mutations, but I think I indicated it was a general thing.
@donmullen The logging is a relatively recent rewrite, so I would be interested in knowing about bugs.
ahhh i see. okay thanks @tony.kay
@levitanong Looks like Fulcro Inspect is breaking it somehow
@tony.kay fascinating. You are talking about the repro repo?
@levitanong this fixes your issue
:D hurrraahhh!!!!
Thanks @tony.kay
Hi,
I am working to figure out how to pass a mutation to a function.
When I "hardcode" it it works fine but when I try to pass it I get an error that the var is undefined.
The following works fine:
{:onClick #(prim/transact! this `[(api/update-something {:db/id ~id})])
Because writing inputs got very repetitive I wrote a function (editfields this editkeys fixedkeys mutation)
.
It builds editable input-fields (for [editfield editfields])
fixedkeys are eg. :db/id which I need for the mutation and mutation should be where I pass api/update-something
.
Everytime I try to pass api/update-something I get an error that the var is undefined. When I quote or syntaxquote it the code will not work.
so, save yourself some big headaches and put the computation logic in a let outside of the quoting
Both examples work, because api/update-office
is there literaly.
How do I replace the literal api/update-office
with a mutation.
(defn do-thing [this m]
(prim/transact! this `[~m]))
(do-thing this `api/update-office)
unquotes happen when quote happens, so don’t expect some weird deferred eval of unquote
@magra you are pulling data directly from dom nodes, that's a very bad thing to do here
you should be updating some state instead, and then just using it on your mutation, your form should have the data on the DB, this way you can just build up your data as user is typing, then you have map all ready to use on the mutation
@wilkerlucio thank you, yes. I am aiming to go that way.
I’ve just release a new lein template for fulco with the following changes:
1. lein new fulcro app
now defaults to shadow-cljs. It’s faster, works better with the js ecosystem, and is just nicer to work with IMO. You can get a figwheel-based project with the lein new fulcro app figwheel
option now.
2. Updated dependencies, including to the new inspect
The uberjar size is also reduced by about 7MB in this new template due to refined deps. Let me know if anyone has issues, and thanks to @thheller for making such a great tool (shadow-cljs).
I also dropped support for v1 apps.
@tony.kay on a blank template, running the test build (on port 8022) will give this error:
[fulcro.client.impl.application] Mutation fulcro-spec.selectors/set-active-selectors failed with exception Error: Vector's key for assoc must be a number.
that’s a minor bug on fulcro-spec I have not figured out. Should not hurt anything….does it?
i’m not entirely sure. 😅 this is the first time i’ve looked into testing.
okidoki! currently trying to figure out why my app test thingy doesn’t seem to work. Considering setting up a new template and just transferring code to see if that makes it work. Will let you know if I find something noteworthy.
(defquery-root :cart/total-price
(value [{::keys [entity]} _]
(let [items (:cart/items entity)
prices (map :item/price items)]
(reduce + prices))))
(defquery-root :cart/total-price-with-carrier
(value [{::keys [entity]} _]
;; ??? \/ it will be here?
(let [total-price (:cart/total-price entity)]
(+ total-price 15))))
there is how to do this? if not, how to handle this? (calculate an attribute based on another calculated)@souenzzo So, I assume you’re putting the entity into the env in some way. If so, then yes, you could do it that way. Personally, I’d define a much more graph-like data structure on the client that included such computed data, and combine it together with a single query.