Fork me on GitHub
#fulcro
<
2017-09-05
>
tony.kay00:09:05

2nd load???

tony.kay00:09:20

you cannot trigger loads from post mutations

tony.kay00:09:32

it is action-only, so remotes aren’t processed

tony.kay00:09:40

If you need more than one load, you need to trigger it from the UI or from the first-class mutation. post mutations are about morphing data that you received, never about chaining actions

tony.kay00:09:00

Think about the chaining case: why do you want to do that? Well, the assumption would be “I need to see what I got back”. No. The server knows what you want to know already. Do the logic there

tony.kay00:09:52

and if the server doesn’t have all the info it needs, pass what it needs to know in the initial remote interaction as params

tony.kay00:09:49

This is part of the reason I’m hesitant to make anything but state available in post mutations (ident and query are ok). The model is designed to keep you away from async behavior as much as possible. If you start chaining things you’re back in callback hell. .

roklenarcic07:09:28

yeah well, that was kinda the idea. I load something, then I see if I need to load more (loading a chain of parents). I cannot do things on the server as I'm using a REST API on a backend that isn't mine. I can however change my network implementation for this call, which is what I'm going to do.

currentoor15:09:31

defsc looks wonderful! 😄

tony.kay17:09:43

@roklenarcic Ah yes…legacy REST. Not the central target market of fulcro 😉

roklenarcic17:09:57

what should be the policy for erroring out when I issue two df/load loads which results in a single network invocation with a combined query for both things, and only one of them fails, but the other one loads successfully? I'm assuming ok/error callbacks expect only one of them to be called and only once?

tony.kay17:09:31

You’re writing your own networking, right?

tony.kay17:09:08

technically everything is just merge. There are some extra bits stacked on, but ultimately you’re just trying to get the correct thing in the app state so the UI shows the right thing

tony.kay17:09:33

the error callback has the plug-ins for fallbacks. Both ok/error have logic for the refresh.

tony.kay17:09:45

But, if you have access to the app (which you can give to your networking layer in started-callback), you can do whatever you need to do. The networking layer is kind of exempt from most rules, because you’re in the guts where async crap has to happen.

tony.kay17:09:22

Or, you could look at FileUPloadNetwork from forms.

tony.kay17:09:07

it implements the updating form of networking, where there is an ok and update and an error. You could just choose to treat an update with error state followed by an ok or error as your way to report errors like that.

tony.kay17:09:59

For your case, I’d probably use the updating network support that you can find an example of in the file upload networking (fulcro.ui.file-upload).

roklenarcic17:09:29

I'll look at the sources, thanks