From 873b451befda1f3854d1cfe805b0901d6c321092 Mon Sep 17 00:00:00 2001 From: Max Grossman Date: Thu, 19 Jul 2018 15:39:20 -0400 Subject: [PATCH] move data presets overwritting to the build function ref #remote-presets' --- modules/presets/index.js | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/modules/presets/index.js b/modules/presets/index.js index e41e42dc6..75553e7c5 100644 --- a/modules/presets/index.js +++ b/modules/presets/index.js @@ -125,7 +125,8 @@ export function presetIndex() { return areaKeys; }; - all.build = function (d) { + all.build = function () { + var d = data.presets; all.collection = []; _recent.collection = []; _fields = {}; @@ -155,7 +156,6 @@ export function presetIndex() { if (d.defaults) { var getItem = _bind(all.item, all); - _defaults = {}; _forEach(Object.keys(d.defaults), function (k) { _defaults[k] = presetCollection(d.defaults[k].map(getItem)); }); @@ -190,14 +190,15 @@ export function presetIndex() { }); return all; }; - + all.overwrite = function (d) { - all.build(d); + data.presets = d; + all.build(); return all; }; all.init = function() { - all.build(data.presets); + all.build(); return all; };