Skip to content

Instantly share code, notes, and snippets.

@tmcw
Created May 20, 2015 20:03
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save tmcw/d7e1cda22253c4324bf5 to your computer and use it in GitHub Desktop.
Save tmcw/d7e1cda22253c4324bf5 to your computer and use it in GitHub Desktop.
var newUploads = Immutable.fromJS(action.value);
// assuming oldUploads is the previous value.
var changeWithStates = newUploads.map(newValue => {
var oldValue = oldUploads.find(other => other.id === newValue.get('id'));
if (oldValue.get('complete') === false && newValue.has('error')) {
return newValue.set('status', 'errored');
}
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment