Define a meta object on an action
See original GitHub issueI have a middleware that looks for actions that have a special property. In classic Redux I normally added a meta key to the action object, which holds information like this, e.g. meta.canUndo or meta.batched.
I thought maybe the second parameter of the action() helper could be used for something like this, but as of now it seems to only support the listenTo option.
Is there a way to have static meta information on an action right now? Or is it considerable to add this in the future?
Btw: With or without a meta object - easy-peasy is an amazing library! Thank you! 😃
Issue Analytics
- State:
- Created 4 years ago
- Comments:11 (8 by maintainers)
Top Results From Across the Web
Meta programming - JavaScript - MDN Web Docs
Object which the proxy virtualizes. It is often used as storage backend for the proxy. Invariants (semantics that remain unchanged) regarding ...
Read more >Meta-Object Facility - Wikipedia
Its purpose is to provide a type system for entities in the CORBA architecture and a set of interfaces through which those types...
Read more >Action objects - Mechanic
An action object defines work to be performed by an action, ... Actions may optionally include meta information, annotating the action with any...
Read more >Levels of Action - LessWrong
But really, you are just making a distinction between object-level changes and meta-level changes regardless of desirability-sign. The ...
Read more >QuickAction | Metadata API Developer Guide
Represents a specified create or update quick action for an object that then becomes available in the Chatter publisher. For example, you can...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found

I worked around this by mixing data and metadata keys in thunk payloads. I use dedicated thunks and requests handlers for each endpoint so can customize the code to separate metadata from real data at each level. It would be nice to have a standard way to receive metadata - like as
helpers.meta- but I’ve been able to work around it.For those wanting a generic way to handle metadata, the
payloadparam in thunks could replicate the standard action structure, like…This could be an optional pattern in common code, accepting a normal payload when metadata is not needed. This sample helper will never change the ‘payload’ value and always returns a ‘meta’ object for consistency…
A couple of ideas for anyone wanting the same metadata option as provided by the FSA action shape.
The Flux-Standard-Action (FSA) includes a
metakey for anything that’s not part of “the payload”. In the reducer pattern below, the data returned by the API does not include acategory_id, but both the API and reducer need it. Theactionargument contains{ type, payload, meta }, but type isn’t needed hereTo keep intermediate methods dumb, meta-data should be passed in a standard/generic way, just as payloads are. Without a separate key/param for this, payloads need a nested, non-standard structures, like this:
However the FSA pattern is simpler and more standard. No longer need a custom payload design.
Occasionally an API and/or reducer requires meta-data. A passed ‘action’ contains both payload and meta. If ‘payload’ becomes it’s own argument, it’s natural for meta to be the next arg. This maintains the flexibility and simplicity of the FSA pattern
{ type, payload, meta }. That’s my pitch!