Host App to Engine's Route Transition with QueryParam of type object is not working properly


#1

In my host app repository, I have an in Repo lazy loading engine.

When I proceed transition from my host app to engine’s route with Query param of type object for the very first time, It shows the error like

SyntaxError: Unexpected token o in JSON at position 1

And if i do the same again, its working fine.

Actually, I found that router._queryParamsFor(handlerInfos) method in “router.js” returns the empty objects(“map” and “qps”) for the first time, the host app tries to transition to engine’s route.

For the next time, it returns the value for the objects(“map” and “qps”), this is happening because the engine’s instance is already created by the previous transition.

Also, if _queryParamsFor method returns an empty object. Since there is no type check for an object in _serializeQueryParam. It will return the string as “[object object]”.

_serializeQueryParam(value, type) {
   if (value === null || value === undefined) {
     return value;
   } else if (type === 'array') {
     return JSON.stringify(value);
   }

   return `${value}`;
 }

How can I proceed the transition to an engine route with object type QP?