diff --git a/src/filter-map.tsx b/src/filter-map.tsx index 9fe09cc..bb649cc 100644 --- a/src/filter-map.tsx +++ b/src/filter-map.tsx @@ -75,7 +75,7 @@ export const filterYDoc = ( const result = predicate(item); if (result) { const path = context.path.join("."); - if (path !== "root") { + if (path.length) { // Skip the root node selectedMap[path] = data; } @@ -108,7 +108,7 @@ export const filterYDoc = ( } traverseYDoc(yDoc, { - path: ["root"], + path: [], }); return selectedMap;