[BUGFIX] - Merge query params from previous transition into active transition#13273
[BUGFIX] - Merge query params from previous transition into active transition#13273rwjblue merged 2 commits intoemberjs:masterfrom
Conversation
There was a problem hiding this comment.
Can this bit of code live in a separate method (_processActiveTransitionQueryParams or something)?
|
Thanks for working on this @raytiley, let me know if I can help... |
|
Come to Maine and babysit for a few hours? I should be able to wrap this On Sunday, April 10, 2016, Robert Jackson notifications@github.com wrote:
|
Sounds fun! Might have to make a pit stop at the Bissell Brothers though.... |
|
@raytiley I'm up to help any way I can, although visiting to babysit might be out of the question. |
There was a problem hiding this comment.
Can you please break this down and add more local vars to make this more readable
|
Hey Everyone... sorry. I've been really busy at work. I promise I will clean this up / get tests this week. |
|
Nevermind, it was due to unrelated route recognizer bug. I've been testing this PR in our app and it seems to fix certain query param issues that broke in 2.4.4 but introduces another bug where initial load of a page with a query 404s. Investigating |
|
First steps... I rebased the code and fixed the jshint error. Tomorrow I'll write some tests based on some jsbin cases I used to write this code. Sorry for the delay. |
There was a problem hiding this comment.
This test looks good!
Seems to me that this test will fail with "Uncaught Error, Assertion Failed: You're not allowed to have more than one controller property map to the same query param key…" without the code to fix.
|
This issue needs to be properly tagged. At least with |
|
@Sinled has discovered a regression with an array query param. Previously, you could have an array query param like this: export default Ember.Controller.extend({
queryParams: ['fields',],
fields: ['field1', 'field2']
})Ember would properly (and transparently!) serialize them into strings and then deserialze back. After the regression, array query params are not deserialized and the Controller's array property gets rewritten with a string. Me and @Sinled managed to narrow down the regression to this commit by @raytiley: Please tell us whether:
|
This comment is not helpful, please keep things constructive.
Bug.
If you didn't find it via a GitHub search, it is a new issue. I personally do not recall an issue opened about 2.4.4 regarding array query params.
If you didn't find it via a GitHub search, it is a new issue. Please test this PR to see if it fixes. |
There was a problem hiding this comment.
I'm running into a similar problem but in my case infos isn't even an array. I did something like:
import { isArray } from 'ember-runtime/utils';
...
if (!isArray(infos) || infos.length === 0) { return; }
|
☔ The latest upstream changes (presumably b125ff5) made this pull request unmergeable. Please resolve the merge conflicts. |
|
I'm totally getting bit by the QPs not being deserialized properly (arrays) in the |
|
@stefanpenner @chancancode question for you, do we need a "regression" label on this? |
|
Related: #13591 |
|
2.4.6 fixed my problem with query params serialisation, but it still present in 2.6.0 |
|
Confirm. This PR is still needed. @igorT - Were you going to pick this up? |
|
☔ The latest upstream changes (presumably #13658) made this pull request unmergeable. Please resolve the merge conflicts. |
This merges in queryParams from an active transition in such a way that
`prepareQueryParams` won't duplicate them. It also won't merge in the
qp if it is already int he qp changed list, for example if it's already
been set during route setup by a call to `controller.set('qpProp',
'someValue')`. Fixing these things with my current test jsbin also
recreated another issue that has been biting people and that is that a
call to `transitionTo` creates an aborted transition that calls
`didTransition` with an empty set of handlerInfos. This would cause the
`updatePaths` method to fail since it couldn't calculate the paths
without the handler infos. We now bail early from `updatePaths` it is
called with an empty array of handlerInfos. I think this is fine
because the aborted transition is followed by a successful transition
that will update the paths appropriatly.
This gets the active queryParams and the provided using the same key
`controller:prop` so that the calls to `assign` override as expected.
This fixes issues where the QP doesn't update properly on refresh
because the merged value conflicts with the provided value.
|
🎉 |
|
Hey everybody who paid attention to this thread! We've a few open bugs likely triggered by this change. Anybody have time to dive in? |
This merges in queryParams from an active transition in such a way that
prepareQueryParamswon't duplicate them.It also won't merge in the qp if it is already int he qp changed list, for example if it's already been set during route setup by a call to
controller.set('qpProp', 'someValue').Fixing these things with my current test jsbin also recreated another issue that has been biting people and that is that a call to
transitionTocreates an aborted transition that callsdidTransitionwith an empty set of handlerInfos. This would cause theupdatePathsmethod to fail since it couldn't calculate the paths without the handler infos. We now bail early fromupdatePathsit is called with an empty array of handlerInfos.I think this is fine because the aborted transition is followed by a successful transition that will update the paths appropriatly.
Still todo - TESTS