Fork me on GitHub
#fulcro
<
2018-06-14
>
myguidingstar07:06:22

pathom question for @wilkerlucio I have this query that works normally when alone: [{[:user/by-id 2] [:user/id :user/name]}

myguidingstar07:06:56

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.

myguidingstar07:06:32

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)

myguidingstar07:06:52

I'm investigating from walkable's side, but do you have any clue why it happens that way?

myguidingstar09:06:20

hmm, I was able to make a simplified code without walkable. This has to do with pathom + clojure.spec + unqualified namespace

wilkerlucio11:06:15

@myguidingstar I tried running your code, but got no error, the code doesn't show what your spec looks like

wilkerlucio11:06:05

can you make a full reproducible example?

tony.kay15:06:16

@danvingo might be a regression. I agree that setting value should force control.

tony.kay15:06:14

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.

tony.kay15:06:41

Oh wait…I think that actually might be an expected behavior. Here’s the reason:

tony.kay16:06:52

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.

tony.kay16:06:06

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.

tony.kay16:06:11

well, on re-reading that: I’m not describing it very well, but yes, that is an expected behavior

myguidingstar16:06:10

@wilkerlucio as I talked about it here, the one without params works, and the one with params doesn't

myguidingstar16:06:29

replace (:other ) with (:other {}), you will see

myguidingstar16:06:37

sorry for not making it clear enough

wilkerlucio16:06:12

@myguidingstar I got it here, seems some issue with the backtick thing

wilkerlucio16:06:18

if you replace that with a regular ' it works

wilkerlucio16:06:28

seems like what is coming back from backtick is not a list, so not a valid query item

wilkerlucio16:06:28

you can either use '(other {}) or (list :other {}) for now

wilkerlucio16:06:38

I'll try to see if there is a sane way to deal with backtick

wilkerlucio16:06:29

user=> (type `(:hello {}))
clojure.lang.Cons
user=> (type '(:hello {}))
clojure.lang.PersistentList

myguidingstar16:06:58

actually it's fulcro in the client that combine the queries in to such batch one

myguidingstar16:06:11

never mind 🙂

wilkerlucio16:06:17

not sure if there is a good way to detect those, we might just have to avoid using backticks for param expressions

wilkerlucio16:06:48

but I think when serialize/deserialize, it always comes back as a list

wilkerlucio16:06:06

(-> `(:hello {})
      type)
=> cljs.core/Cons
(-> `(:hello {})
      (write-transit)
      (read-transit)
      type)
=> cljs.core/List

wilkerlucio16:06:23

that's why we don't have problems sending it from fulcro network

myguidingstar16:06:15

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

wilkerlucio16:06:55

well, check if you are not transforming on your side somehow

wilkerlucio16:06:18

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

wilkerlucio16:06:16

@myguidingstar another thing you can use, run (s/explain (s/keys) env)

wilkerlucio16:06:47

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

myguidingstar17:06:45

thanks, I'll try this tmr

currentoor17:06:03

@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

tony.kay17:06:11

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.

tony.kay17:06:01

and the compiler can’t “optimize away” requires (easily) because those nses could have side-effecting you want (e.g. defmethod)

tony.kay17:06:10

so, don’t have requires you don’t need.

tony.kay17:06:36

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

tony.kay17:06:20

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.

tony.kay17:06:06

Also, each of those files will be super-fast to compile, since they are all small.

tony.kay17:06:50

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”

tony.kay17:06:51

If you want to edit what I just wrote and PR it into the book, that’d be great 🙂

currentoor18:06:17

thanks and sounds good!

tony.kay18:06:06

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.

👍 4
tony.kay18:06:58

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.

dvingo19:06:27

@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.

Chris Swanson21:06:59

is anybody here using fulcrologic/semantic-ui-wrapper ?

Chris Swanson21:06:02

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

Chris Swanson21:06:37

must be possible because the normal fulro.client.dom/input works fine

Chris Swanson21:06:40

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

wilkerlucio21:06:22

@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

wilkerlucio21:06:29

maybe something there can help you

Chris Swanson21:06:57

ok, i'll check it out, thanks for the advice

tony.kay22:06:12

Fulcro 2.5.9 released. Minor bug fixes. Primary improvement is better stack traces on mutation and rendering errors. https://github.com/fulcrologic/fulcro

aw_yeah 16
bananadance 12
👍 8
currentoor23:06:14

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