Fork me on GitHub
#fulcro
<
2020-07-20
>
zilti10:07:43

I have a component with :route-segment ["tenant" :tenant-id] but the router won't accept it. I get "Spec failed. :tenant-id should satisfy string?". I have no clue why this happens. This is a valid route segment, and I use the same thing in other forms.

tony.kay15:07:59

@U2APCNHCN route segments are FORCED to strings (because they must be supportable from URLs which are strings). You’re probably passing a non-string to one of the functions that does routing, and it is warning you that you’ve used non-string data in routes.

zilti16:07:30

It doesn't even call the will-enter function though

zilti16:07:47

The routing works fine when using Fulcro's and Fulcro RAD's routing functions, but as soon as I want to access a parametrized page by URL, as in typing it in the address bar and pressing return, it falls apart

zilti16:07:11

Maybe some client middleware?

tony.kay16:07:28

take a look at other thread @U2APCNHCN

zilti13:07:04

Okay I created another new form with a route segment with a keyword and get the same error as well...

magra15:07:44

My route segments are either ["person-list"] or ["person" :person/id] in the first case my :ident is a function (fn [] [:component/id :person-list]) and in the latter it is :person/id .

dvingo15:07:45

I have a top level property in my app db that I want to load a collection of idents into, but I want the load to but cumulative (issuing multiple loads should append data and not clear the vector) - when I issue a df/load! that targets that top level property the data from the load overwrites the collection that is there - using target append-to does not work either. Is this a supported use case or will I have to use a mutation and handle the merge logic myself?

tony.kay16:07:58

what do you mean “`append-to` does not work either”? Ah, append-to might to for to-one only. I would consider that an oversight…I’ve never used it for that. I’d accept a PR for a check in append-to that would do collections I guess. Your option right now is just to make it a post-mutation of your own. Ultimately, that’s all data targeting is.

dvingo17:07:19

yep - it's a collection of idents - I will try out the post mutation option for now and may look into updating the data targeting to support that.

magra15:07:54

@danvingo I do that with append-to.

magra15:07:52

It works but can cause duplicate entries when appending.

lgessler22:07:03

The fulcro docs for form state have this example input:

(dom/input {:value    (or name "")
            :onBlur   #(comp/transact! this [(fs/mark-complete! {:entity-ident [:person/id id]
                                                                 :field        :person/name})
                                             :root/person])
what's the :root/person doing in the transaction?

jb recluse02:07:15

i think @danvingo correctly described its function below. as additional info, the book appears to call it a "follow-on read" if i understand correctly. http://book.fulcrologic.com/#_historical_note_on_older_approaches http://book.fulcrologic.com/#_combining_routing_with_data_management

tony.kay05:07:42

Yes, that’s it exactly. The original rendering model asked the user for hints on “dependent refreshes”. These are still allowed and rendering can still use them (ident-optimized), but the current best practice is to use a renderer that doesn’t need the help.