Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Proposal #8

Closed
goatslacker opened this issue Jul 3, 2015 · 8 comments
Closed

Proposal #8

goatslacker opened this issue Jul 3, 2015 · 8 comments

Comments

@goatslacker
Copy link

Continuing from our conversation on slack:

{
  // string | number: a unique identifier for the dispatch
  id: 'abcdef123',

  // any: Symbol, string, number, object, function. A unique way to identify the action dispatched
  type: ActionTypes.ADD_TODO,

  // any: whatever is being dispatched
  payload: { text: 'Create FSA Proposal' },

  // information about the action itself
  action: {
    // string representation of the particular action type
    // since Symbols are not strings and action type can be anything, having a way to identify an
    // action as a string is useful for serializing, debugging, and logging.
    id: 'ActionTypes.ADD_TODO'
  },

  // other information about the dispatch
  meta: {
    // no opinions here...
    status: 'success'
  }
}

There's a difference between dispatch and action. I need to uniquely identify dispatches, this is useful for time travel, rollback, etc. I also need to be able to unique identify actions, this is good for logging and debugging.

I think this is a good MVP. I was using details for action information in alt but I think action is a better name.

@acdlite
Copy link
Contributor

acdlite commented Jul 3, 2015

Couldn't you merge action and meta into a single field?

@goatslacker
Copy link
Author

Yes you can, I just think action is a better name because meta may refer to meta information about the dispatch. Whereas action is explicit, it refers to data about the action.

@acdlite
Copy link
Contributor

acdlite commented Jul 3, 2015

How are you distinguishing between the dispatch and the action? To me they're synonymous (or rather, each action represents a distinct dispatch). I get your "class vs. instance" analogy from our Slack conversation, but I don't really think it fits. To me the only field here that kinda feels like a "class" property is type. And type is only meant for introspection. Isn't everything else specific to the dispatch or "instance"?

@goatslacker
Copy link
Author

We need more information than just the type. Since the type can be anything.

In alt I include a string representation of the type, the name of the action, and the namespace.

Everything else is dispatch info.

@acdlite
Copy link
Contributor

acdlite commented Jul 3, 2015

Okay, so if everything else is dispatch info, action and meta can be merged together, right?

@acdlite
Copy link
Contributor

acdlite commented Jul 3, 2015

Could actions in Alt look like this instead?

{
  // any: Symbol, string, number, object, function. A unique way to identify the action dispatched
  type: ActionTypes.ADD_TODO,

  // any: whatever is being dispatched
  payload: { text: 'Create FSA Proposal' },

    // information about the action itself
  meta: {
    // string | number: a unique identifier for the dispatch
    id: 'abcdef123',

    // string representation of the particular action type
    // since Symbols are not strings and action type can be anything, having a way to identify an
    // action as a string is useful for serializing, debugging, and logging.
    displayType: 'ActionTypes.ADD_TODO'
  }
}

@goatslacker
Copy link
Author

yeah that looks good enough. Not sure about the displayType name but we can work on it

@goatslacker
Copy link
Author

Closing this in favor of #4 which looks like a better issue.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants