mozilla / remote-newtab

Remotely-hosted New Tab Page
https://mozilla.github.io/remote-newtab/src/
Mozilla Public License 2.0
15 stars 7 forks source link

change action formats to {type: ..., data: ...} #193

Closed oyiptong closed 8 years ago

oyiptong commented 8 years ago

right now, the page is expecting data at the top level of the object:

switch (action.type) {
    case c.REQUEST_SUGGESTED_DIRECTORY:
      return updateState(prevState, {
        isSuggestedLoading: true
      });
    case c.RECEIVE_SUGGESTED_DIRECTORY:
      return updateState(prevState, {
        isSuggestedLoading: false,
        suggested: action.suggested,
        directory: TileUtils.formatDirectoryTiles(action.directory)
      });

this suggests that the data looks like:

{type: "RECEIVE_SUGGESTED_DIRECTORY", suggested: ...}

How about we do:

{type: ... data: { suggested: ...}}

it's an almost no-cost abstraction and one can list the data attributes easily

k88hudson commented 8 years ago

Agreed :+1: