ember.js icon indicating copy to clipboard operation
ember.js copied to clipboard

Route's lazy loading engine not parsing queryParams of type `array`

Open alias-mac opened this issue 7 years ago • 1 comments

I wasn't able to find an issue around the problem that me and my team were running into, thus I'm creating a new issue here.

Please see: https://github.com/alias-mac/ember-engines-demo for an example of the bug.

Go to: http://localhost:4200/foo?category=test&filter=[1,2,3]&complexFilter={%22something%22:%22useful%22} and compare the console.log output with the lazy loaded engine: http://localhost:4200/admin-section/foo?category=test&filter=[1,2,3]&complexFilter={%22something%22:%22useful%22}

If the engine is not set as lazy loaded, it will work fine, because ember will go through all the available handlers of the routes and verify if any of the queryParams need to be parsed. When it is a lazy loaded engine, then the handlers won't exist until the route of the "mount" is hit, but due to: https://github.com/emberjs/ember.js/blob/470dddb9bbea32f0bf71219740b22c8dc8ecf68d/packages/ember-routing/lib/system/route.js#L2351-L2361 it will not parse it again and just returned the state.fullQueryParams that were cached before.

A quick hack is provided in the demo: https://github.com/alias-mac/ember-engines-demo/blob/master/lib/admin-section/addon/routes/foo.js#L19-L22 Where we are reseting the cache in beforeModel to try to bypass this problem.

What is the correct/better approach here? Or is this a valid bug?

alias-mac avatar May 21 '18 06:05 alias-mac

Might be related to #16655

Serabe avatar Jun 08 '18 15:06 Serabe