src/reducers/map.js
function updateSource(state, action) {
  const old_source = state.sources[action.sourceName];
  const new_source = {};
  new_source[action.sourceName] = Object.assign({}, old_source, action.sourceDef);
  const new_sources = Object.assign({}, state.sources, new_source);

  let metadata;
  if (new_source[action.sourceName].type === 'geojson') {
    metadata = incrementVersion(state.metadata, dataVersionKey(action.sourceName));
  } else {
    metadata = incrementVersion(state.metadata, SOURCE_VERSION_KEY);
  }
  return Object.assign({}, state, {
    sources: Object.assign({}, state.sources, new_sources),
  }, metadata);
}
function updateSource(state, action) {
  const old_source = state.sources[action.sourceName];
  const new_source = {};
  new_source[action.sourceName] = Object.assign({}, old_source, action.sourceDef);
  const new_sources = Object.assign({}, state.sources, new_source);

  let metadata;
  if (new_source[action.sourceName].type === 'geojson') {
    metadata = incrementVersion(state.metadata, dataVersionKey(action.sourceName));
  } else {
    metadata = incrementVersion(state.metadata, SOURCE_VERSION_KEY);
  }
  return Object.assign({}, state, {
    sources: Object.assign({}, state.sources, new_sources),
  }, metadata);
}
Update a source's definition.
This is a heavy-handed operation that will
just mixin whatever is in the new object.
@param {Object} state Current state.
@param {Object} action Action to handle.

@returns {Object} The new state.