Fork me on GitHub
#fulcro
<
2021-09-01
>
sheluchin13:09:04

If I have two components, ItemList and Item, and my ItemResolver includes an :item/item-list key, that key's value should be a map like :item/item-list {:item-list/id :special-list} rather than a flat value like :item/item-list :special-list, right? I think that using a map will allow Pathom to make a connection between :item/item-list while using a flat value will not.

lgessler14:09:30

right, you need to have the value paired with :item/item-list be a map in order for Pathom to understand it as an entity that it can use other resolvers to expand

👍 2
lgessler16:09:39

so the normal way to resolve a route-deferred is to include {:post-mutation dr/target-ready ...}` in the options map of a load!--is it also OK to to just transact that mutation (`(comp/transact! app [(dr/target-ready {...})])`) right after the load? I think the load is required to finish before the processing of the next transaction is allowed to proceed, right?

Jakub Holý (HolyJak)17:09:48

I don't think Fulcro waits on remote calls. load! is essentially a mutation and only mutstion's actions are evaluated in order. The remote sections are started in order but the response will be handles when it arrives, tx processing doesn't wait for it

👍 2
lgessler18:09:49

I see, thanks--based on my scenario, it looks like grouping all my mutations into a single tx and then using a pessimistic transaction (https://book.fulcrologic.com/#PTransact) might be the move

👍 2
Björn Ebbinghaus11:09:04

You can also call target-ready! (note the ! ) inside a mutation.

👍 2
sheluchin19:09:09

The df/load! docs mention: > - server-property-or-ident : A keyword or ident that represents the root of the query to send to the server. If this is an ident you are loading a specific entity from the database into a local app db table. A custom target will be ignored. But example 3 here https://fulcro-community.github.io/guides/tutorial-minimalist-fulcro/#_loading_remote_data uses an ident (`[:employee/id 123]`) and includes a :target in the config. Isn't that an example of custom targeting, which, according to the docs snippet above, should be ignored?

tony.kay19:09:40

docstring is wrong. Pretty sure load will put the ident (via targeting) wherever you target it.

sheluchin19:09:57

Would you like me to remove that last sentence in a PR?

tony.kay19:09:58

could be that Fulcro pre-version 2 was that way...so probably just "out of date"

👍 2
Jakub Holý (HolyJak)19:09:12

Perhaps the docstring is just unclear? Even in my example the data still ends up in the db under the ident, targeting only adds a "pointer" to that data to another part of the DB. Perhaps the docstring meant that it is not possible to relocate the data to elsewhere? (though it in fact may be possible nowadays?)

Jakub Holý (HolyJak)20:09:17

FYI both minimalist-fulcro-template-backendless and fulcro-exercises have been modified to invoke shadow via npx and to work with Calva's Jack-in (see the respective READMEs). (Calva does not like it when you start shadow manually via clojure -M:... as it wants to set its own main options.)

👍 4
Hukka05:09:06

Yeah, you needed to "connect to an existing repl" using the shadow, not let calva start it (or at least needed to reconnect)