Fork me on GitHub
#fulcro
<
2019-04-03
>
mail22812:04:16

Hi @tony.kay I noticed that namespaces docs are missing from 2.8.8 but they are available in 2.8.0 https://cljdoc.org/d/fulcrologic/fulcro/2.8.8/doc/readme https://cljdoc.org/d/fulcrologic/fulcro/2.8.0/doc/readme

martinklepsch13:04:40

Happy to assist in getting this fixed 🙂

martinklepsch13:04:36

Note that badges will soon indicate if there has been a problem during analysis

martinklepsch14:04:44

The exception that causes the analysis to fail can be seen here: https://circleci.com/gh/cljdoc/builder/3472

martinklepsch15:04:14

If anyone would like to help fix this, feel free to pop into #cljdoc, happy to provide pointers/guide someone through the process.

tony.kay16:04:43

@ how do I tell it to use aliases to get classpath right?

tony.kay16:04:44

looks like you want a checked-in pom.xml for that?

martinklepsch16:04:19

will reply in 25min

martinklepsch16:04:08

Hey @tony.kay 🙂 So cljdoc looks at the pom.xml that has been pushed to the Maven repository (Clojars in this case) — dependencies with scope "provided" or "optional" will be included. The easiest way to ensure those dependencies will be present is to add them to your project.clj or similar with one of these scopes.

tony.kay17:04:44

I found that…I am using clj deps, and lein for clojars with deps plugin…perhaps I just need to change the aliases there.

martinklepsch17:04:59

yeah, it seems like the dependencies from the :provided alias don't show up in your pom.xml: http://repo.clojars.org/fulcrologic/fulcro/2.8.8/fulcro-2.8.8.pom

tony.kay17:04:25

Yeah, I see that

tony.kay17:04:38

doing 6 things right now…I’ll get to this one at some pt

tony.kay17:04:41

thanks for the help

martinklepsch17:04:46

sure thing! sorry cljdoc is causing you extra work 😄

martinklepsch17:04:36

Maybe @ feels brave and would like to help with this? 🙂

tony.kay17:04:01

all that has to happen is a change to the alises used by the deps plugin in project.clj

tony.kay17:04:03

and testing

tony.kay17:04:51

but if I add the aliases in project, will that cause the provided deps to transitively infect using projects…that kind of testing

tony.kay17:04:08

the change takes 5 seconds…the testing a bit more

martinklepsch17:04:36

right, but as long as they end up in pom.xml with scope "provided" all will be good

martinklepsch17:04:56

have to run now but might take a look at this tomorrow if no one beats me to it

mail22819:04:29

Wish I could help but don't think I can, I am very new to the entire ecosystem, never did any Clojure, just a little ClojureScript

martinklepsch07:04:44

@ no worries! 🙂

njj15:04:37

Trying to require in [fulcro.ui.bootstrap3 :as bs] and getting an error: java.lang.RuntimeException: No such var: cljs.core/INamed, compiling:(fulcro/i18n.cljc:55:1)

tony.kay16:04:05

@njj bootstrap stuff is moving to legacy and I do not plan to support it. That said, let me look…

njj16:04:23

its all good, I have bootstrap loaded in via my css

tony.kay16:04:19

I don’t get an error

tony.kay16:04:59

also works if I pull in i18n and use tr

tony.kay16:04:17

@njj I cannot reproduce in 2.8.8 from a CLJS file…you using CLJC?

njj16:04:36

no its cljs

njj16:04:46

[fulcrologic/fulcro "2.5.8-SNAPSHOT"]

tony.kay16:04:51

why that version?

njj16:04:05

it was what was recommended by you when coming from untangled

tony.kay17:04:20

oh…if you have 2.5.8 working, I’d try moving on to a newer version…don’t remember why, but I probably made some little fix for you there that would be in any later version

njj18:04:14

If my fields for a form aren’t ::, and just regular keywords, how does validation work? i..e a field of mine is :subtotal_amount, it seems that (fs/get-spec-validity form field) is just always returning :unchecked and my spec definition is (s/def ::subtotal_amount #(s/int-in-range? 1 200 %)

thenonameguy12:04:26

You have to use namespaced keywords as you cannot registered plain keywords in spec.

njj18:04:33

oh perhaps I need to make things as complete?

njj19:04:36

Ah but now I’m back at [fulcro.ui.form-state] FORM NOT NORMALIZED: [:update-booking :tab] 😐

njj20:04:50

@tony.kay Everything else seems to be working, except the onBlur completion. I’m still getting a form not normalized error, any ideas? https://gist.github.com/njj/271054aead0c5644571460ad5c9dbe69

currentoor04:04:29

since that bootstrap stuff isn’t supported anymore, i recommend you consider using this instead https://github.com/fulcrologic/semantic-ui-wrapper

currentoor04:04:11

it’s a thin wrapper around React Semantic UI, which has good documentation and has tested thoroughly

currentoor04:04:39

that’s what we’ve been using in our projects

currentoor06:04:02

of course this is just a friendly suggestion simple_smile

njj11:04:00

Thanks for the recommendation, I’ll check it out. Although this is just using bootstraps css, which my entire application uses. Not the fulcro lib.

njj11:04:30

Unless you think my issues are related to that? Right now the error from fulcro is about the form not being normalized. @

tony.kay15:04:19

line 152…you’re adding form config to a form with id nil?

tony.kay15:04:30

pls read the chapter carefully in the book and think about normalization and what it means for something to be “joined in a query” of a component…it means there will be a valid ident point to a valid db table from that entity to the other. Just having “some config” in the database doesn’t mean it is the right thing or in the right place

tony.kay15:04:03

Each instance of you entity being edited has to have its own associated config…that stores that instance’s pristine state, etc. That’s how it works. The form-state namespace is nothing more than some state helpers. You can do forms however you want. The job of form state is to save a copy of your entity state and diff it. That’s pretty much it. It can only do that if you make a 1-to-1 live data association between your form ui and an instance of form state config.

tony.kay15:04:37

Putting some config in the db at id nil isn’t making that association, and will never work.

njj16:04:27

@tony.kay Is it possible to pass the _id from the booking to the initial state then?

tony.kay16:04:41

yes, params are allowed to be passed when you call get-initial-state

tony.kay16:04:03

you have to design your application to know what is where, when…nothing magic here

tony.kay16:04:42

In a real application, when you edit a form you know the ID of the thing you want to edit, so you load it…and you can have a post mutation that adds the form config

tony.kay16:04:00

and the post mutation params are sent with the load, which is where you knew the id, so you can pass them then.

tony.kay16:04:49

and then you’re in a mutation, so you can use the mutation helper versoin of add-config and don’t even need initial-state…because form entities are typically not known at app start time…you load them, or have an ID in a URL, etc, etc.

njj16:04:51

This is a real application, I know the id - I just init’d the fields as nil because I couldn’t find a way to pass in props data into the initial-state

tony.kay16:04:29

initial state is essentially for rendering the first frame of the app when it mounts

njj16:04:31

I was looking for docs on what the params are in the initial-state function, but can’t seem to find anything. When printing them out they were nil

tony.kay16:04:33

not about runtime

tony.kay16:04:04

runtime is mutations

tony.kay16:04:14

and post mutations

tony.kay16:04:47

The initial state params are passed from the parent, when you compose initial state to root

njj16:04:11

I even have booking-id being passed in as well as part of the query, which would be easier to access then (:_id booking) I assume.

tony.kay16:04:12

but again, that is for static initialization of the first render frame, not active operational stuff

tony.kay16:04:12

so if your form is something like “login”, you can know the identity of that entity (it’s a singleton) and add form config on app start…for all other kinds of forms, initial-state is not what you want

njj16:04:57

my form is editing data from a server side fetch, then sending a PUT once the user is done

tony.kay16:04:58

unless you’re going to manually call it from a mutation with get-initial-state and pass it parameters yourself as a convenient place to put it…initial-state is not used by Fulcro after that except when you explicitly tell it to in a few narrow cases

tony.kay16:04:12

you’re using AJAX?

njj16:04:24

the data is fetched server side

njj16:04:43

this is an old untangled app, being converted to fulcro

tony.kay16:04:48

are you using fulcro loads with post-mutations?

njj16:04:20

let me check, I think its using fulcro.server’s dispatch

njj16:04:58

everything on that end is a bit abstracted by the original author

njj16:04:12

(defmethod api-read :booking [env _ {:keys [booking-id]}]
  (let [booking (auth/booking-by-id! booking-id)]
    {:booking booking}))

njj16:04:23

so it may be confusing, since its not your fulcro code

tony.kay16:04:42

So, the book has clear running examples of all of these cases with source, full-stack simulations, viewable active databases, etc. If you need help porting an app, please engage me as a consultant. I simply don’t have a lot of “free” time.

njj16:04:20

so the part I could be missing is the post-mutations?

njj16:04:42

the form things are working fine, until I try to add in the onBlur and adding validation to the fields