Fork me on GitHub
#fulcro
<
2020-12-01
>
njj15:12:41

I have a subform that is setup via comp/get-query but it seems that the props of the parent aren’t reflecting the updated values of the subform, while the app state for that subform’s ident does.

tony.kay15:12:23

@njj but when you print the props of the parent they print on each change but have the old values?

njj15:12:58

The parent props don’t seem to be changing onChange of the subform

njj15:12:39

The form values are an array, so its something like:

njj15:12:25

(mapv #(ui-price-form (prim/computed % {:edit-mode? listing-edit?})) prices)

njj15:12:57

where the query in the parent is, {:prices (prim/get-query PriceField)}

tony.kay15:12:26

what is your onChange?

njj16:12:58

(dom/input
            :.form-control
            {:type     "text"
             :value    value
             :id       value
             :onChange #(m/set-string! this :value :event %)
             :onBlur   #(prim/transact! this `[(fs/mark-complete! ~{:entity-ident [:price/by-id _id]
                                                                    :field        :value})
                                               :price/by-id])})

njj17:12:43

@U0CKQ19AQ Do you think it has to do with the onBlur?

njj17:12:43

Although, I have seen callback methods passed via the computed props before for updating form values - but I didn’t that that would be necessary in this case.. Since each has its own set of values for the subform

tony.kay18:12:47

what are you using for renderer? Did you change tx processing plugin?

tony.kay18:12:52

no, I don’t think it is blur

tony.kay18:12:23

#(m/set-string! this :value :event %)
The name of your field is an unqualified :value????

tony.kay18:12:42

that is really confusing to my eye 😜

😆 3
tony.kay18:12:02

Also, in f3 you do not need to quote txns

tony.kay18:12:28

unless you’re using f2, in which case you’re using ident-optimized render and what you’re seeing is expected behavior

👍 3
tony.kay01:12:22

@U010LFZGFEG does that mean that was your problem?

njj01:12:05

I’m on Fulcro 2, I ended up just flattening the data a bit and making the field value part of the parent form - removing the subform all together

njj01:12:47

Also yes the field name from the db is value lol

tony.kay01:12:30

so, all you needed to do was add a refresh to the transaction (a keyword in the parent’s query)

tony.kay01:12:56

it’s a data-driven refresh model. F3 switched to not needing that as much, but you just tell it a keyword in the parent query to get the parent to refresh

tony.kay01:12:25

(transact! this [… :parent/key]) will do it on transactions

tony.kay01:12:53

I really recommend moving to F3 if you can…so many nicer things there

njj20:12:49

it’s on the list, just need to find the time amongst features

njj20:12:18

I may not be able to migrate easily 😅. It might be a new app and porting stuff over

Ben Grabow17:12:12

The Fulcro developer's guide recommends java 1.8.x, but I'm running a java 11 openjdk build. What problems should I expect to see if I use java 11?

souenzzo17:12:12

@ben.grabow AFIK there is no "direct problem", but some other common libraries of fulcro ecosystem, like #datomic, still recommends java8 Also, #shadow-cljs had some problems with newer JVM (I had a issue with the deprecation of nashorn for example). But shadow usually fix this kind of issue very fast (docs/templates/examples can't flow)

👍 3
nivekuil18:12:13

what. I never knew.. I guess the book is misleading here? https://book.fulcrologic.com/#Transactions ctrl+f `[( has 73 matches

Björn Ebbinghaus18:12:05

Like Tony said in Fulcro 3 you don’t have to quote, but you still can. (Calling Mutations just returns a quoted version of them) Many examples in the book are from Fulcro 2 where you had to quote.

tony.kay19:12:39

right, I need to fix that. The new macro emits a function that emits its own form as data

nivekuil18:12:42

huh, the book actually does have api/delete-person called there without a quote. never noticed that. hope I'm not alone?