Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[BUGFIX beta] Don't throw an error, when not all query params are passed to routerService.transitionTo #15613

Merged
merged 3 commits into from Oct 10, 2017

Conversation

CvX
Copy link
Contributor

@CvX CvX commented Aug 30, 2017

This PR attempts to fix two issues:

  1. A bug introduced in [FEATURE ember-routing-router-service] isActive and Cleanup  #15414.
    Using transitionTo via router service fail with an error, unless all query parameters of the target route are passed into the method. Here's the failing test: https://github.com/CvX/ember.js/blob/1c8c6ecad42228e94deffb7672fc6de905fca007/packages/ember/tests/routing/router_service_test/transitionTo_test.js#L259-L277.
    And for googling folks, the error message was Error: Assertion Failed: You passed the `false` query parameter during a transition into [route-name-here]}, please update to [query-param-here].
  2. A problem reported in Query params with values null or undefined get serialized into strings #4570 (and attempted to be fixed in [query-params-new] don't serialize null or undefined to url #4571). This fix (originally by @raytiley) is required to make the above use case work. Without it, transitioning to a route that has multiple query params ends up with all of them in the url with the value null, i.e.
  Ember.Controller.extend({
    queryParams: ['q', 'other', 'stuff']
  });

  // in some component
  this.get('router').transitionTo('articles', {
    queryParams: { q: 'test' },
  });

  // We end up at: /articles?q=test&other=null&stuff=null
  // Instead of (after the fix): /articles?q=test

cc: @rwjblue

raytiley and others added 3 commits August 30, 2017 14:24
…ined into url

# Conflicts:
#	packages/ember/tests/routing/query_params_test.js
#	packages_es6/ember-routing/lib/system/route.js
@Serabe
Copy link
Member

Serabe commented Sep 3, 2017

Restarted sauce labs

@CvX
Copy link
Contributor Author

CvX commented Sep 3, 2017

Failed again, any idea what's wrong?
The message (UnknownError - An unknown server-side error occurred while processing the command. Selenium error: Unable to get property 'bad' of undefined or null reference) doesn't tell me much! 😁

@DingoEatingFuzz
Copy link
Contributor

Thank you @CvX! I ran into this while upgrading as well.

@CvX
Copy link
Contributor Author

CvX commented Sep 7, 2017

Alright, dunno who did what, but sauce labs tests are now passing! 🎉

@rwjblue
Copy link
Member

rwjblue commented Sep 8, 2017

Thanks for working on this! I'm not 100% sure that we want the null/undefined coercion as described in #4571 / #4570. Can you explain why that change was required in order to fix the router service test case you added?

@CvX
Copy link
Contributor Author

CvX commented Sep 8, 2017

Null/undefined fix isn't needed for the router service exception fix, but it just feels wrong to write a test that expects the url to have "queryParams=null". 😅 (see snippet in the original comment of this PR)

@rmachielse
Copy link

Is there anything blocking at least the fix for the first issue from being merged? It is keeping us from upgrading to 2.15

@toranb
Copy link
Contributor

toranb commented Sep 28, 2017

ping @rwjblue ^^ any further debate or discussion required on this PR boss?

@pichfl
Copy link

pichfl commented Oct 6, 2017

We're waiting for this to be released, any chance this will show up in 2.16?

@alexdiliberto
Copy link
Contributor

alexdiliberto commented Oct 9, 2017

Any updates here? What are the specifics for not allowing the type coercion?

This issue prevents our app from using the router service in several places. It just doesn't feel right that doing the same transition from a template {{#link-to}} and some random route transitionTo(...) don't behave exactly the same as some component's get(this, 'router').transitionTo(...) in this circumstance

@toranb
Copy link
Contributor

toranb commented Oct 10, 2017

Any word from ember core team here? I know ember v2.16.0 shipped without this fix ...

@CvX
Copy link
Contributor Author

CvX commented Oct 10, 2017

Alright, to make it easier to move this forward I'm splitting the PR into two:

@CvX CvX closed this Oct 10, 2017
@rwjblue rwjblue reopened this Oct 10, 2017
@rwjblue rwjblue merged commit f4bbfe2 into emberjs:master Oct 10, 2017
@rwjblue
Copy link
Member

rwjblue commented Oct 10, 2017

Apologies for not getting this in for 2.16, I'll get the changes into the next 2.17 beta release and once some folks can confirm all is working well for us I'll pull down into 2.16 for the LTS.

@rwjblue
Copy link
Member

rwjblue commented Oct 10, 2017

@CvX - Thank you very much for working so hard on this!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

9 participants