Skip to content

Commit

Permalink
Fix iteration over concept trees when setting default filter values (#62
Browse files Browse the repository at this point in the history
)

* Fix iteration over concept trees when setting default filter values

* Use const instead of let
  • Loading branch information
rs22 committed Feb 16, 2018
1 parent e9cab00 commit b5a041d
Showing 1 changed file with 5 additions and 6 deletions.
11 changes: 5 additions & 6 deletions frontend/lib/js/category-trees/actions.js
Original file line number Diff line number Diff line change
Expand Up @@ -46,12 +46,11 @@ export const loadTrees = (datasetId: DatasetIdType) => {
dispatch(loadTreesSuccess(r));

// Assign default select filter values
Object.values(r.concepts).forEach(concept => concept.tables.forEach(table =>
table.filters.forEach(filter => {
if (filter.defaultValue)
filter.value = filter.defaultValue;
})
));
for (const concept of Object.values(r.concepts))
for (const table of concept.tables || [])
for (const filter of table.filters || [])
if (filter.defaultValue)
filter.value = filter.defaultValue;

// In the future: Data could be cached, version could be checked and
// further data only loaded when necessary
Expand Down

0 comments on commit b5a041d

Please sign in to comment.