untangled

NEW CHANNEL: #fulcro
2016-07-27T00:22:34.000234Z

So I wrote a mutation using load-field-action, I need to transact on this (transact! 'this' [(my-mutation)]) for load-field-action to work its magic, now i've realized I need to transact! this mutation from a parent component

2016-07-27T00:22:52.000235Z

so I don't have access to the 'this' anymore

2016-07-27T00:23:24.000236Z

what's the canonical move to make here (1) move away from load-field-action? (2) use om next index to locate the component (3) ??

gardnervickers 2016-07-27T13:46:43.000237Z

@jasonjckn: I recommend taking a look at the OmNext or Untangled tutorials about passing callbacks to child components using om/computed props.

2016-07-27T15:16:55.000238Z

@jasonjckn: I’m not completely understanding. If my-mutation has a load-field-action inside of it, that means it is loading’ [:some :query] within its action thunk from the remote. is that right? why do you need to transact from the parent component? you’re in the scope of a mutation, so the only way to re-render the parent is to tack a follow-on read onto the load-field-action

mahinshaw 2016-07-27T15:38:26.000241Z

I think passing down the mutation in om/computed is a trivial way to solve this. But @ethangracer is right, you could also use follow on reads.

2016-07-27T15:45:40.000242Z

that’s what I’m trying to clarify — I’m not sure this is solvable with om/computed because it has to do with remote loads

mahinshaw 2016-07-27T16:10:37.000243Z

ohh, right. I missed the load field action bit

mahinshaw 2016-07-27T16:11:09.000245Z

why not just run a follow on mutation/read

mahinshaw 2016-07-27T16:11:16.000246Z

that comes from computed

mahinshaw 2016-07-27T16:12:11.000247Z

more precisely a second mutation/read (as opposed to a follow on in the first transaction).

2016-07-27T16:46:53.000248Z

Is it expected that an exception during a read request from the /api endpoint will swallow all exceptions and return 200 OK with no data? Seems like a bug - should at least have a non-200 status?

2016-07-27T16:49:28.000249Z

@therabidbanana: no, exceptions that aren’t in the untangled format should be returning 500 errors

2016-07-27T16:52:54.000252Z

Our logs have this in it: https://github.com/untangled-web/untangled-server/blob/master/src/untangled/server/impl/components/handler.clj#L73 but the response is 200 OK, so I guess I'll see if I can get a good test case and log a bug for it/fix it.

2016-07-27T16:55:17.000255Z

sure, if you can reproduce it feel free to submit an issue

2016-07-27T19:08:06.000256Z

@ethangracer: So I have TabUnion which aggegregates my tabs, X, Y, Z UI components, the X tab aggregates SearchResults UI component, I have a my-mutation that does load-field-action on :search-items field of SearhResults UI component. so load-field-action requires that the env map has SearchResults for :component key, and [:search-results <identifier>] for :ref key. So that mutation must be transacted on SearchResults UI instance

2016-07-27T19:08:53.000257Z

@ethangracer: most of my transact! are done from within the render function of SearchResults so it works fine, but I also now realized I need to transact! my-mutation from the TabUnion (parent of SearchResults)

2016-07-27T19:09:28.000258Z

if I transact! my-mutation on this (the TabUnion instance) that won't work because :component and :ref won't be set correctly for load-field-action

2016-07-27T19:09:56.000259Z

so how should I solve this? one way would be to change my-mutation to load-data-action, not sure if that's the canonical way

2016-07-27T20:14:03.000262Z

So it does look like sometimes a 200 gets returned, at least in the setup I put in the cookbook. Is the expected behavior to return a generic 500 message?

2016-07-27T20:20:54.000263Z

@jasonjckn: I have a similar situation where I want to load a field in one component from another. And yes, instead of using load-field, I’m using load-data-action and providing the fully-qualified query. not sure there’s another way around it, but its not a solution I’m a huge fan of.

2016-07-27T20:21:26.000264Z

so I don’t think there is a more canonical way, but if you find another approach I’d be interested in hearing it

2016-07-27T20:25:01.000265Z

@therabidbanana: thanks, I’ll take a look at that when I have some time

2016-07-27T20:32:01.000266Z

@ethangracer: the only other solution I can think of is using om index to locate the component and transact on this, or similar sort of location logic in the mutation

2016-07-27T20:32:49.000267Z

@ethangracer: it's also kind of annoying when you want a child to transact on it's parent too, similar story, except in that situation the parent can pass itself via computed props to the child

2016-07-27T20:33:06.000268Z

oh, sorry @therabidbanana yes the expected behavior is to return a 500

2016-07-27T20:33:41.000269Z

@jasonjckn: yeah our team has found that to be a pain point too

tony.kay 2016-07-27T20:34:09.000272Z

Ethan, talk to me about the problem in person, perhaps I can help

2016-07-27T20:34:59.000273Z

@tony.kay: will do