datopian / frontend-showcase-js

Javascript frontend code for the DataHub
https://datahub.io
9 stars 3 forks source link

[future] How to do Redux store (if we do it again) #128

Closed rufuspollock closed 7 years ago

rufuspollock commented 7 years ago

Various "notes to self" about we do Redux store if we do it again (from mid Feb)

Our app state (redux store):

{
  # maybe only one data package - but what about publisher page ...
  # theDataPackage: {},
  packages: {
    #  id looks like "publisher/name"
    "{id}": datapackageDescriptor - normalized ...
  },
  resources: {
    "{dataPackageId}::{idx}
  },
  views: {
    "{dpId}::{viewIndex}"
  }
  dataPackageResourcesByName: # do we need this ...
  # data package resource data - maybe we should name that way ...
  blobs: {
    "{resourceId}": ...
  }
}

Note:

FAQ

 How to handle nested entities like DataPackages?

http://redux.js.org/docs/recipes/reducers/NormalizingStateShape.html http://redux.js.org/docs/recipes/reducers/UpdatingNormalizedData.html

Asynchronous Data

http://redux.js.org/docs/advanced/AsyncActions.html

https://github.com/reactjs/redux/issues/99 - Best async loading technique (old issue)

Various options:

Structure for actions - use https://github.com/acdlite/flux-standard-action

{
  type: 'ADD_TODO',
  payload: 'xxx'
  error: true
}
rufuspollock commented 7 years ago

INVALID. Not an issue and now very obsolete.