From 732efe68ca885abc4de380a72476fd779636ad57 Mon Sep 17 00:00:00 2001 From: Seth Ladygo Date: Mon, 20 May 2019 01:21:39 -0700 Subject: [PATCH] editor store: ignore dup materials --- cateditor/src/pages/editor/store/index.js | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/cateditor/src/pages/editor/store/index.js b/cateditor/src/pages/editor/store/index.js index 185a6f7..6c14e54 100644 --- a/cateditor/src/pages/editor/store/index.js +++ b/cateditor/src/pages/editor/store/index.js @@ -340,17 +340,17 @@ export const store = new Vuex.Store({ for (let section of state.catalog.sections) { let models = getters.sectionModels(section) let existingModel = models.find(m => m.model === material.model) - console.log('section', section.id, 'existing model search', existingModel) if (existingModel) { - // prevent duplicates here, but also allow adding the same + // console.log('section', section.id, 'found existing model', existingModel) + // NOTE prevent duplicates here, but also allow adding the same // id again to a catalog. put in a new section so it can be - // placed elsewhere? - let existingMaterial = existingModel.ids.find(m => m.id === material.id) - console.log('model', existingModel.model, 'existing material', existingMaterial) + // placed elsewhere? handle later. + let existingMaterial = existingModel.ids.find(m => m === material.id) + // console.log('model', existingModel.model, 'existing material', existingMaterial) + foundSection = section + foundModels = models if (!existingMaterial) { existingModel.ids.push(material.id) - foundSection = section - foundModels = models } else { console.log('skip duplicate') }