diff --git a/src/db/gpx.ts b/src/db/gpx.ts index c90d966..d712ad0 100644 --- a/src/db/gpx.ts +++ b/src/db/gpx.ts @@ -1,4 +1,4 @@ -import { cloneDeep } from 'lodash'; +import { cloneDeep, isEmpty } from 'lodash'; import { PureComponent } from 'react'; import { $DEVCOMP } from 'solid-js'; import { Point, Rectangle } from '../components/map/types'; @@ -111,12 +111,15 @@ const prune = ( ...extensions, ...subObjects[index].extensions, }; + if (isEmpty(subObjects[index].extensions)) { + subObjects[index].extensions = undefined; + } docs.push({ _id: getUri(key, subId), type: key, doc: subObjects[index], }); - prune(subId, subObjects[index], previousGpx, extensions, docs); + prune(subId, subObjects[index], previousGpx, {}, docs); } object[key] = undefined; } else prune(id, object[key], previousGpx, extensions, docs);