reductive-dev-tools icon indicating copy to clipboard operation
reductive-dev-tools copied to clipboard

Serialize nested (poly)variants?

Open TomiS opened this issue 5 years ago • 3 comments

I hava a store with nested reducers and nested action generators like this

// Root action in root store
type action = [
  | `User(User_Store.action)
  | `Customer(Customer_Store.action)
  | `DevToolsUpdate('state)
];
// Customer_Store.re
type action = [
  | `GetCustomerRequest(Types.ObjectId.t)
  | `GetCustomerSuccess(Customer_Types.Customer.t)
  | `GetCustomerFailure(string)
];

So I dispatch these like this:

dispatch(`Customer(`GetCustomerSuccess(result)));

Now, the dev tools only show this as Customer, which is better than nothing but unfortunately hides the interesting part.

Wondering if there would be a way to serialize also the inner polyvariant to get something like this out.

Customer: GetCustomerSuccess

Thanks for the nice tool again!

TomiS avatar Apr 15 '20 21:04 TomiS

@TomiS: this should work out of the box, will investigate, also just to note, you may also define custom action serialize if needed.

ambientlight avatar Apr 16 '20 04:04 ambientlight

Cool, so I assume it should also serialize nested normal variants by default. (changed the title a little)

TomiS avatar Apr 16 '20 09:04 TomiS

yes, when they are not plain(with constructors)

ambientlight avatar Apr 16 '20 10:04 ambientlight