Skip to content

Commit b737a3f

Browse files
committed
flip the loop in recordUiEdit
1 parent 7a21285 commit b737a3f

File tree

1 file changed

+4
-5
lines changed

1 file changed

+4
-5
lines changed

Diff for: dash-renderer/src/persistence.js

+4-5
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,6 @@ import {
4949
equals,
5050
filter,
5151
forEach,
52-
forEachObjIndexed,
5352
keys,
5453
lensPath,
5554
set,
@@ -191,15 +190,15 @@ export function recordUiEdit(layout, newProps) {
191190
return;
192191
}
193192

194-
forEachObjIndexed((newPropVal, propName) => {
193+
forEach(propName => {
195194
// TODO: this only supports specifying top-level props to persist
196195
// DO we need nested specification?
197196
// This *does* support custom methods to save/restore these props,
198197
// so if we persist `columns` on a table, the component can specify
199198
// to only keep & restore the names, associating them with IDs.
200199
// It just wouldn't allow us to separately enable/disable persisting
201200
// something else inside columns.
202-
if (persisted_props.indexOf(propName) !== -1) {
201+
if (newProps[propName]) {
203202
const storage = stores[persistence_type];
204203
const transform = getTransform(element, propName);
205204

@@ -218,9 +217,9 @@ export function recordUiEdit(layout, newProps) {
218217
) {
219218
setOriginalAndId();
220219
}
221-
storage.setItem(newValKey, transform.extract(newPropVal));
220+
storage.setItem(newValKey, transform.extract(newProps[propName]));
222221
}
223-
}, newProps);
222+
}, persisted_props);
224223
}
225224

226225
function clearUIEdit(id, persistence_type, propName) {

0 commit comments

Comments
 (0)