Fork me on GitHub
#fulcro
<
2018-05-21
>
myguidingstar07:05:44

regarding form state, is there a way to tell fulcro NOT to take a field (a keyword) as subform?

myguidingstar15:05:37

@U0CKQ19AQ can you help with this?

tony.kay15:05:27

Hey, so I’m not sure what you mean. If you don’t list something in the declaration of form fields, then it isn’t used…If it’s a join to a component, then it needs to be a sub-form or it can’t be managed properly.

myguidingstar15:05:42

well, I'm building the tag editor part of an article editor. The query of the form component looks like this

[:article/id :article/title/body
 {:article/tags [:tag/tag]}
 fs/form-config-join]

tony.kay15:05:56

but isn’t there a Tag component that you get-query from?

tony.kay15:05:09

for :tag/tag

myguidingstar15:05:21

but it doesn't have an ident b/c they're just strings. Also, I want the form component to treat those tags as a single vector

tony.kay15:05:43

So, I don’t know if I’ve tested doing this, but you could make :tags a prop (NOT a join) and just treat the array of strings as an opaque value

myguidingstar15:05:47

so after I manipulate that vector, I can push update (to remote server) the article item with those tags as a whole

tony.kay15:05:00

the diff support might not work with that, though…

tony.kay15:05:14

but it might…worth a try. i.e. query is just [... :article/tags] without the join

myguidingstar15:05:01

hmm, walkable doesn't support such "prop that actually is a join to another table" yet 😄

myguidingstar15:05:14

let's see if I can change the query of the editor form's parent component

tony.kay15:05:07

walkable is using pathom…wonder if you can just add a resolver somehow

myguidingstar15:05:09

a plain pathom resolver will result in inablity to use such join in sever side filters (in this case, filter articles by their tags)

tony.kay15:05:44

why not just use a different name in the pathom resolver?

tony.kay15:05:05

not perfect, but possibly doable

myguidingstar15:05:45

yup, possible, I just don't want inconsistence where I write queries one way and filters another

myguidingstar15:05:22

anyway, I've planned to solve that problem with walkable, just haven't touched it

myguidingstar15:05:15

for now, I'd stick to change the fulcro load

myguidingstar15:05:58

thanks for your time

myguidingstar16:05:43

But I think it would be great if form state can help with managing pristine state of data structure, too

tony.kay18:05:17

The older form support probably can, since you can declare what is a sub-form explicitly, and which are “fields”…and you can also declare custom field types.

tony.kay18:05:12

The join issue with the newer form support is an interesting use-case.

tony.kay18:05:22

not sure that design can deal with that. It’s part of the reason that I didn’t deprecate the old forms support. It is a bit heavier overall, but it also does things that the newer support doesn’t. I dislike having two, but I have not had time to unify the useful things, and I don’t think we’ve had enough heavy use of the forms to enable us a good idea of what is missing.

myguidingstar01:05:45

indeed. Even when the join target does have its own ident, there are cases where you want to keep track of the whole list of idents (some of which can still be tempids) and send off to remote in a single transaction. I will think more about this

myguidingstar07:05:54

I want to use some nested Clojure data structure as the field's value while having fulcro manage its pristine state. Its query is a join, but the join target doesn't have its own ident.

myguidingstar07:05:44

what does "Older Support" in "Full Form Management (Older Support)" mean? Is it no longer recommended?

claudiu07:05:27

@myguidingstar

The form state support concentrates just on providing utilities to manage the data, and has validation that is based on Clojure Spec but is completely pluggable. The full form management support is the older version that attempts to isolate your components a bit more from the event and state management, but at the expense of some added complexity.

Both are fully supported, though the form state support is considered the cleaner implementation.

👍 4
donmullen17:05:39

I have added html5 routing following example in fulcro routing video (which uses bidi/push). Have top-level routing w/o parameters working. Just now adding params and getting

Uncaught Error: No protocol method ParameterEncoding.encode-parameter defined for type object: 57346128458562730
The id is a datomic entity id. Pointers welcome.

donmullen17:05:17

Evidently bidi didn’t like the long - so converting to string worked. Looking more closely at the bidi docs re: parameter matching.