This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2018-06-14
Channels
- # beginners (183)
- # boot (6)
- # cider (106)
- # cljs-dev (17)
- # cljsjs (2)
- # cljsrn (2)
- # clojure (56)
- # clojure-italy (14)
- # clojure-nl (39)
- # clojure-spec (49)
- # clojure-uk (138)
- # clojurescript (197)
- # core-logic (37)
- # cursive (22)
- # datascript (5)
- # datomic (29)
- # devcards (18)
- # emacs (1)
- # events (8)
- # figwheel (1)
- # fulcro (59)
- # lein-figwheel (1)
- # leiningen (1)
- # off-topic (54)
- # onyx (3)
- # pedestal (1)
- # portkey (4)
- # re-frame (18)
- # reagent (5)
- # reitit (43)
- # ring (6)
- # ring-swagger (26)
- # shadow-cljs (42)
- # spacemacs (8)
- # specter (12)
- # sql (3)
- # tools-deps (21)
- # vim (18)
pathom question for @wilkerlucio I have this query that works normally when alone: [{[:user/by-id 2] [:user/id :user/name]}
but if the root query contains another query with params in it eg [{[:user/by-id 2] [:user/id :user/name]} (:other {})]
, I got an exception complaining :ast
in env
is missing.
while these still work [{[:user/by-id 2] [:user/id :user/name]} (:other)]
or [{[:user/by-id 2] [:user/id :user/name]} :other]
(no params for :other
)
I'm investigating from walkable's side, but do you have any clue why it happens that way?
hmm, I was able to make a simplified code without walkable. This has to do with pathom + clojure.spec + unqualified namespace
see it here https://gist.github.com/myguidingstar/0541fd3f145657fa4fb5743354439401
@myguidingstar I tried running your code, but got no error, the code doesn't show what your spec looks like
can you make a full reproducible example?
I had to change that code a bit when I fixed the ref bug a few months ago. I didn’t notice it losing control. I’ll open an issue and take a look.
On certain versions of IE there is a bug where events don’t come in sequence and the controlled component seems to lose keystrokes. Very annoying.
The workaround is to use local state on the component to “cache” the changes “in hopes” that the event will eventually arrive and bring the real state up to date.
well, on re-reading that: I’m not describing it very well, but yes, that is an expected behavior
@wilkerlucio as I talked about it here, the one without params works, and the one with params doesn't
replace (:other )
with (:other {})
, you will see
sorry for not making it clear enough
@myguidingstar I got it here, seems some issue with the backtick thing
if you replace that with a regular '
it works
seems like what is coming back from backtick is not a list
, so not a valid query item
you can either use '(other {})
or (list :other {})
for now
I'll try to see if there is a sane way to deal with backtick
user=> (type `(:hello {}))
clojure.lang.Cons
user=> (type '(:hello {}))
clojure.lang.PersistentList
actually it's fulcro in the client that combine the queries in to such batch one
never mind 🙂
not sure if there is a good way to detect those, we might just have to avoid using backticks for param expressions
but I think when serialize/deserialize, it always comes back as a list
(-> `(:hello {})
type)
=> cljs.core/Cons
(-> `(:hello {})
(write-transit)
(read-transit)
type)
=> cljs.core/List
that's why we don't have problems sending it from fulcro network
I'm not sure about (de)serialize. I ran into this problem with a query sent from fulcro client. However, my server is not fulcro server, I just use transit+pathom
well, check if you are not transforming on your side somehow
because those special types of list should just end up as lists after decoding, you can try debug just after your deserialization and check it out
@myguidingstar another thing you can use, run (s/explain (s/keys) env)
if you just use s/keys without anything, it will try to validate all the keys, and that is the thing triggering the error for you I guess
thanks, I'll try this tmr
@tony.kay in the book when you say
> Keep your namespaces small, and :require sections pruned. This is about “size of code to compile”, but it’s more about the dependency graph. I’ve gone almost to the point of single artifacts per file.
does that mean only one main function per file? or only 1 entry in :require
? maybe it’s just me, but i was confused by what this meant
thanks for the feedback. Think about how compile works: You save a file. I analyzes what uses that file. It does that by looking at which other files require the one you just changed. If a lot of files require it, then they (and all the files that use those files) will haev to recompile as well.
and the compiler can’t “optimize away” requires (easily) because those nses could have side-effecting you want (e.g. defmethod)
Also, if a file has a small number of things in it, then fewer other files will require it…thus reducing the number of things to recompile towards their minimum
If you take it to (the admitedly painful) extreme of one artifact (e.g. function) per file, then you’d get the fastest possible compile performance, since the bare minimum graph would be recompiled.
A good balance it to try to minimize the artifacts in a file to something “reasonable”…where I can’t tell you exactly what that means. Somewhere between “painfully too small” and “sluggishly large”
thanks and sounds good!
Version 2.5.9 is coming soon…it is 2.5.9-SNAPSHOT at the moment, and is on clojars. It improves the error message from failing mutations to include a better stack trace. I’ll push it as an official release later this afternoon after some more testing…love to hear feedback from others testing it before release.
the other fixes change the load marker behavior when targeting a to-many relation, a fix to the sc
macro (rarely used), and a fix to transaction combining that prevents conflicts.
@tony.kay thanks for the feedback - if that's expected then that's fine, I am just using my own input factory which doesn't have any setState to get around it. My use case is having a numerical text input where I remove any non-digit input, I was seeing the wrapped-input ignoring what value I passed in.
is anybody here using fulcrologic/semantic-ui-wrapper ?
i'm losing my mind trying to figure out how to prevent the cursor from jumping to the end of the line when a change event occurs
must be possible because the normal fulro.client.dom/input works fine
but when i replace with ..semantic-ui.factories/ui-input , cursor starts jumping to the end whenever I type, so you can't insert mid-word anymore
@chrisjswanson controlled inputs can be tricky, you can try to get some tricks from this code that I wrote to wrap a codemirror input, it uses debounce and other tricks to avoid too much changing out of time: https://github.com/wilkerlucio/oge/blob/master/src/com/wsscode/oge/ui/codemirror.cljs#L64-L112
maybe something there can help you
ok, i'll check it out, thanks for the advice
Fulcro 2.5.9 released. Minor bug fixes. Primary improvement is better stack traces on mutation and rendering errors. https://github.com/fulcrologic/fulcro


@tony.kay where exactly is the source for the book? i’m having trouble finding it 😅