Fork me on GitHub
#fulcro
<
2018-06-05
>
levitanong17:06:17

@wilkerlucio trying out the latest fulcro-inspect. It seems to work for me, except i’m getting odd multimethod errors about :com.wsscode.pathom.connect/indexes. Fulcro-inspect appears to be attempting to use my custom remotes with some query keyed by that keyword above.

levitanong17:06:35

i believe it’s hitting all my remotes

wilkerlucio18:06:56

@levitanong yes, on initialisation it tries to pull the pathom indexes, but I'm considering remove this auto-load, you are the second person having issues with that

wilkerlucio18:06:39

I had the assumption that peoples parsers would just ignore unknown keys, but seems like it's not the case

tony.kay18:06:15

heh…that was a rather big assumption 😄

😄 12
wilkerlucio18:06:05

yeah, I'll try to make a new release today fixing that, another big one is that I want try an hybrid encoding mode

parrot 4
wilkerlucio18:06:26

instead of trying to "fix" the transit compilation by walking, I wanna see if I can just encode via EDN when transit fails

wilkerlucio18:06:38

and see how that goes, so both can be a release soon (maybe later today)

wilkerlucio19:06:25

@levitanong is that blocking you from using it? or just an annoying error?

levitanong03:06:32

Just an annoying error as far as I can tell. Sorry, I was asleep. Timezones and all. Haha

jasonjckn20:06:38

@tony.kay we’re nearly onto fulcro, I saw you’ve been answering nicks questions thanks a lot for the help, i got pulled in for a couple remainder issues,

#(transact! T [(listing-details/upload-images {:parentId _id
T = the UI component here , it’s not a reconciler, or null. And yet the handler
(defmethod fulcro.client.mutations/mutate :default [env k params]
the env has NIL for key :component

jasonjckn20:06:09

it’s worth mentioning that it’s not that the key no longer exists in env, it’s present, but just NIL

jasonjckn20:06:15

is this a bug?

tony.kay20:06:04

Hey @jasonjckn. I just found a bug yesterday where lazy seqs are not getting forced

tony.kay20:06:13

is this in release only, or in dev, too?

jasonjckn20:06:21

only tested in dev so far

tony.kay20:06:26

ok, so that’s not it 😕

tony.kay21:06:10

not ringing a bell…pretty sure component is still added to env internally…let me dbl check

wilkerlucio21:06:43

it's strange, I use those in Fulcro Inspect, and I'm seeing the component information present on results

jasonjckn21:06:52

should be pretty easy to reproduce , :component is nil for all mutations I see getting hit

tony.kay21:06:58

yep. being addded

wilkerlucio21:06:05

@jasonjckn are you using fulcro inspect?

wilkerlucio21:06:28

if you do, you can try checking if the component shows up in the transaction history

jasonjckn21:06:33

just did a js/console.log

(defmethod fulcro.client.mutations/mutate :default [env k params]
  (js/console.log "fulcro.mutate")
  (js/console.log env)

tony.kay21:06:59

can’t see how component would be nil and transact still work

wilkerlucio21:06:23

is not :action missing there?

tony.kay21:06:26

parser called on 2416

tony.kay21:06:33

oh, in fact it is 😄

tony.kay21:06:50

but even then env should be ok

jasonjckn21:06:59

hmh yah code looks good.. weird not sure why i’m seeing this

jasonjckn21:06:49

pasted a screenshot can you guys see it ?

jasonjckn21:06:55

Your file was uploaded — it's safe and sound in Slack. Unfortunately your workspace doesn't have any storage space left. To get more space, you can upgrade to a paid account or delete some of your older files

tony.kay21:06:16

you sure you’re passing a component?

tony.kay21:06:21

to transact!

tony.kay21:06:40

could you log that out at the transact call site?

tony.kay21:06:05

OH…is your component missing a query?

tony.kay21:06:47

if it is a stateless component, then :component isn’t set

tony.kay21:06:30

because technically then that component isn’t in any indexes, and isn’t safe to use for certain ops I think.

jasonjckn21:06:37

yes no query

jasonjckn21:06:44

this must have changed in fulcro then

tony.kay21:06:54

basically transact! walks up the tree looking for a stateful component to run the tx against…:component will be set to the first component above it that has a query

tony.kay21:06:21

that logic came from Om Next

tony.kay21:06:45

but it is possible something got changed

jasonjckn21:06:24

seems like a reasonable request to know which component was transacted against?

tony.kay21:06:28

actually, the walking to the parent code might be unreachable

jasonjckn21:06:39

and it’s not returning a parent component, it has nil for the component

tony.kay21:06:19

right…what I just said…I think has-query? might have been recursive in the past…e.g. me nor any parent has a query

tony.kay21:06:04

so, “which” component was “transacted against” is a good question in terms of purpose…the transactions are related to state, which only ends up in the UI via queries.

tony.kay21:06:20

which is the reasoning behind :component being something that has a query

jasonjckn21:06:07

the parent of this component has a query

jasonjckn21:06:30

seems like you could reason :component being the parent component, or the one it was transacted on

jasonjckn21:06:35

but currently it’s nil , which makes no sense to me

tony.kay21:06:02

it is nil because the logic looks broken on that scan

tony.kay21:06:17

the cond tests if it has a query, and then just runs it with a nil component

tony.kay21:06:33

so, I can see why it is nil…I was talking about the intended (apparent) behavior

tony.kay21:06:08

I’d have to look at Om Next’s source to verify my assertions there

tony.kay21:06:12

about intended behavior

tony.kay21:06:44

nope…looks like the same problem there

tony.kay21:06:19

same logic…so, IF there is no query on the component, it looks to me like Om Next/Untangled/Fulcro will all make :component nil

jasonjckn21:06:26

hmm, i’m quite positive this has been non-nil in the past

jasonjckn21:06:33

so something changed somewhere.. but yah not clear where

tony.kay21:06:39

When I ported that I was looking for max compatibility. I could be convinced that the logic is wrong, since it looks weird to me

tony.kay21:06:05

If it HAS a query, why would you need to recursively look for a parent with a query

tony.kay21:06:35

I think the logic is just wrong…Also, I tend to agree with you: it seems harmless to pass the component into mutation, even if it has no query

jasonjckn21:06:22

yah we certainly put that information to good use

tony.kay21:06:34

oh…re-rendering logic: The transact wants to refresh the component whose data changed…which MUST be a component (in Fulcro) with a query and ident

tony.kay21:06:51

otherwise it is forced to do a root render

tony.kay21:06:08

and that component gets “queued” if present

tony.kay21:06:24

but you would not want to queue a stateless component, since there is no way to refresh it in isolation

jasonjckn21:06:46

yes, I believe we can make do with :component = parent component

jasonjckn21:06:55

i definitely understand the reasoning for that

tony.kay21:06:56

but in that case you’re supposed to use callbacks

tony.kay21:06:08

to run the transact via the stateful parent

tony.kay21:06:36

but it looks like the logic in place is meant to scan for the parent, so I think either should work

tony.kay21:06:43

it just doesn’t because the logic is wrong 😜

tony.kay21:06:01

let me try a fix…just a min

tony.kay21:06:10

@jasonjckn Try 2.5.8-SNAPSHOT

tony.kay21:06:40

it isn’t the parent component that will get passed in…it will be the correct one. The parent logic is for tx intercepters, which are not even documented

jasonjckn21:06:52

Nice, love it

jasonjckn21:06:01

one can always crawl the tree downward if you need to

jasonjckn21:06:07

so you have maximal information this way

tony.kay21:06:37

upward? You will get the exact component that transacted, no matter what

👍 4
tony.kay21:06:04

the parent traversal wan’t changing :component, it is propagating messages to components that are parents that implement that protocol

tony.kay21:06:22

which no one does, because it is an undocumented/supported feature 🙂

jasonjckn21:06:46

sadly i’m running into a bunch of issues trying to move from 2.4.4 to 2.5.x , not sure I can test right now on 2.5.8-SNAPSHOT, but this patch gets my thumbs up

jasonjckn21:06:14

I think there’s more stringent checks on defui in 2.5.x (shouldComponentUpdate [T next-props next-state next-context] is failing to compile

jasonjckn21:06:21

it’s using React’s Context feature

tony.kay21:06:12

using defui?

tony.kay21:06:25

validate signatures has not changed

tony.kay21:06:36

defsc might think it incorrect

tony.kay21:06:46

well, both should actually

tony.kay21:06:55

since both try to validate signatures

jasonjckn21:06:03

can I disable the extra spec validation?

jasonjckn21:06:10

shouldComponentUpdate [T next-props next-state next-context] is valid in react

tony.kay21:06:45

hm…let me look into it for a sec

tony.kay21:06:06

what version supports next-context?

jasonjckn21:06:44

this was an experimental feature in react v15.x trying to check the status of this in react v16.x

tony.kay21:06:08

I see no docs saying that is a legal method sig

tony.kay21:06:49

so yeah…not sure I want to do that

tony.kay21:06:54

why do you need it?

jasonjckn21:06:57

so the old API is still supported

jasonjckn21:06:00

but deprecated

jasonjckn21:06:02

React previously shipped with an experimental context API. The old API will be supported in all 16.x releases, but applications using it should migrate to the new version

jasonjckn21:06:37

we built our own forms ontop of this feature

tony.kay21:06:03

what is it used for, specifically?

jasonjckn21:06:10

well the feature itself sort of works like clojure’s bindings and dynamic vars except instead of call stacks it’s child-parent components, and props instead of vars

jasonjckn21:06:37

so you can pass props from parent to child implicitly with a context

jasonjckn21:06:25

so specifically in our forms, we a bootstrap form-group that sets up a context

jasonjckn21:06:41

and all child nodes, e.g. bootstrap submit button, text fields, etc can see this context

tony.kay21:06:01

does this context change after bootstrap?

jasonjckn21:06:27

you can change it yah , not sure I follow

tony.kay21:06:44

trying to figure out if shared is appropriate alternative

jasonjckn21:06:20

well there’s a new conetxt api in react v16 with different signature than the legacy api

jasonjckn21:06:27

it’s a feature that gets used enough

tony.kay21:06:46

but it doesn’t affect the lifecycle sigs I don’t think

jasonjckn21:06:53

right not anymore

jasonjckn21:06:23

so I get why you don’t want to support this, it’s non trivial to change this part of our app right now

jasonjckn21:06:28

so we’re still on 2.4.4

tony.kay21:06:29

so port to that and it’ll work…but not sure how you ever got it past Om Next

tony.kay21:06:34

or 2.4.4 of Fulcro

tony.kay21:06:39

that validation has been there for years I think

jasonjckn21:06:53

hmh, thought this error only showed up in 2.5.x

jasonjckn21:06:56

i will need to confirm though

jasonjckn21:06:11

Caused by: java.lang.AssertionError: Assert failed: Invalid signature for shouldComponentUpdate got [T next-props next-state next-context], need [this next-props next-state]
(= (count sig') (count sig))
	at fulcro.client.primitives$validate_sig.invokeStatic(primitives.cljc:218)
	at fulcro.client.primitives$validate_sig.invoke(primitives.cljc:216)
	at fulcro.client.primitives$reshape$reshape_STAR___15608.invoke(primitives.cljc:424)
	at clojure.core$map$fn__5587.invoke(core.clj:2745)
	at clojure.lang.LazySeq.sval(LazySeq.java:40)
	at clojure.lang.LazySeq.seq(LazySeq.java:49)
	at clojure.lang.RT.seq(RT.java:528)

tony.kay21:06:36

So all versions of Untangled and Fulcro should have balked

jasonjckn21:06:07

ok, i’ll keep digging , but only seeing this compiler error in 2.5.x so far

tony.kay21:06:26

you could elide asserts

jasonjckn21:06:33

ah good idea/hack

tony.kay21:06:49

I don’t know if “good idea” is how I’d describe that 😜

jasonjckn21:06:01

hence the edit

jasonjckn21:06:24

“you could ignore all exceptions” good idea! XD

jasonjckn21:06:16

in any case, your patch for 2.5.8 gets my vote

jasonjckn21:06:28

prob won’t be able to test it for a while though

jasonjckn21:06:50

in the interim I may just add queries everywhere that’s affected by this, but will be happy to upgrade when we can

tony.kay21:06:24

OH…I know why it is validating now…I made it possible to override shouldComponentUpdate

tony.kay21:06:41

rather…I added a wrapper

tony.kay21:06:09

you could override it before, but the latest versions give you next-props and next-state of Fulcro…not low-level React

tony.kay21:06:18

and adding that wrapper caused it to start validating

tony.kay22:06:35

@jasonjckn an easiler workaround is to call transact* directly

tony.kay22:06:32

(transact* (get-reconciler this) this nil tx)

tony.kay22:06:43

make yourself a little wrapper function

jasonjckn22:06:13

@tony.kay > “you could override it before, but the latest versions give you next-props and next-state of Fulcro…not low-level React” ok, any other ideas besides eliding asserts for this one