From b5efe6c578f851cefb69213473ea89a0f2c45122 Mon Sep 17 00:00:00 2001 From: Zaid Abdulla Date: Thu, 5 Sep 2019 17:16:21 -0700 Subject: [PATCH] Fix session.serialize bug --- lib/session.ts | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/lib/session.ts b/lib/session.ts index 991dedb..f3360b6 100644 --- a/lib/session.ts +++ b/lib/session.ts @@ -771,6 +771,9 @@ function runDeclarations( let path = declaration.path; let unpacked: Path[]; + // Can't run declarations on root + if (!path.length) continue; + if ( (path.alias | path.wildcard) & 1 || path.segments[0] === "VirtualParameters" @@ -2621,8 +2624,13 @@ export async function serialize( deviceData.push(e); } + const declarations = sessionContext.declarations.map(decs => { + return decs.map(d => Object.assign({}, d, { path: d.path.toString() })); + }); + const jsonSessionContext = Object.assign({}, sessionContext, { deviceData: deviceData, + declarations: declarations, syncState: null, toLoad: null, httpRequest: null,