emberjs / emberjs/ember.js

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

Open
#16,655 2 comments 0 reactions 0 assignees View on GitHub
Needs Bug Verification Routing
Dominant language
TypeScript
Stars
22.6k
Forks
4.2k
Avg merge
3d 12h
Merged PRs (30d)
15

Description

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, host app tries to transtion to engine's route.

For the next time, it returns the value for the objects("map" and "qps"), this is happening becuase engine's instance is already created by the previous transition.

Also, if _queryParamsFor method returns 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?

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.