diff --git a/ui/app/lib/path-to-tree.js b/ui/app/lib/path-to-tree.js index 254cd7fc2bc2..9142f545c4d5 100644 --- a/ui/app/lib/path-to-tree.js +++ b/ui/app/lib/path-to-tree.js @@ -45,7 +45,7 @@ export default function(paths) { return deepmerge.all( tree.map(p => { p = p.replace(/\.+/g, DOT_REPLACEMENT); - return unflatten({ [p]: null }, { delimiter: '/' }); + return unflatten({ [p]: null }, { delimiter: '/', object: true }); }) ); } diff --git a/ui/tests/unit/lib/path-to-tree-test.js b/ui/tests/unit/lib/path-to-tree-test.js index 4c7788dabe83..733d11e568d9 100644 --- a/ui/tests/unit/lib/path-to-tree-test.js +++ b/ui/tests/unit/lib/path-to-tree-test.js @@ -49,6 +49,24 @@ module('Unit | Lib | path to tree', function() { }, }, ], + [ + 'leaves with nested number and shared prefix', + ['ns1', 'ns1a', 'ns1a/99999/five9s', 'ns1a/999/ns3', 'ns1a/9999/ns3'], + { + ns1: null, + ns1a: { + 999: { + ns3: null, + }, + 9999: { + ns3: null, + }, + 99999: { + five9s: null, + }, + }, + }, + ], ]; tests.forEach(function([name, input, expected]) {