fix(metadata): Saving on non-existent models should not throw

This commit is contained in:
Ben Gotow 2016-02-25 16:28:56 -08:00
parent 24939caa78
commit 080ff933f2

View file

@ -24,7 +24,7 @@ class MetadataStore extends NylasStore {
return (
t.modelify(modelClass, _.pluck(models, 'clientId'))
.then((latestModels)=> {
const updatedModels = latestModels.map(m => m.applyPluginMetadata(pluginId, metadataValue));
const updatedModels = _.compact(latestModels).map(m => m.applyPluginMetadata(pluginId, metadataValue));
return (
t.persistModels(updatedModels)
.then(()=> Promise.resolve(updatedModels))