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] Rename private property Route#router to Router#_router #16312

Merged

Conversation

cibernox
Copy link
Contributor

@cibernox cibernox commented Mar 2, 2018

The fact that this private property was named router was preventing users
from injecting the router service into routes like this:

export default Route.extend({
  router: service()
});

I consider that the above code is pretty reasonable, and it should be
the private property the one that should be renamed to a clearer _router
name that is less likely to collide with user-defined properties or methods.

If you deem this an intimate API we could consider adding a deprecated
alias, but I don't have evidence to consider it such, as router is too
common of a term to search for in emberobserver.

Closes #16088

@cibernox
Copy link
Contributor Author

cibernox commented Mar 2, 2018

@Serabe ^

Copy link
Member

@rwjblue rwjblue left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, I think we need to deprecate this.router in Ember.Route instances (and add an entry on the website to describe how to handle the deprecation).

When folks inject the router service, it would clobber this "deprecating getter" and things should work just fine...

@cibernox
Copy link
Contributor Author

cibernox commented Mar 2, 2018

Working on it

@cibernox cibernox force-pushed the rename-private-property-route.router branch from af3023b to f4a28f6 Compare March 2, 2018 19:34
@cibernox cibernox changed the title Rename private property Route#router to Router#_router [BUGFIX beta] Rename private property Route#router to Router#_router Mar 2, 2018
@cibernox
Copy link
Contributor Author

cibernox commented Mar 2, 2018

@rwjblue Done. I considered this a bugfix beta and I added the deprecation in 3.1, but let me know if you prefer it to stay in canary and go in 3.2.

@rwjblue
Copy link
Member

rwjblue commented Mar 19, 2018

let me know if you prefer it to stay in canary and go in 3.2

yeah, lets move to 3.2 on the deprecations app. I don't want to land a last minute deprecation just before release that ends up souring the yummy goodness of 3.1...

The fact that this private property was named router was preventing user
from injecting the router service into routes like this:

```js
export default Route.extend({
  router: service()
});
```

I consider that the above code is pretty reasonable, and it should be
the private property the one that should be renamed to a clearer `_router`
name that is less likely to collide with user-defined properties or methods.

If you deem this an _intimate_ API we could consider adding a deprecated
alias, but I don't have evidence to consider it such, as `router` is too
common of a term to search for in emberobserver.
@cibernox cibernox force-pushed the rename-private-property-route.router branch from f4a28f6 to 4690f63 Compare March 19, 2018 13:37
@cibernox
Copy link
Contributor Author

@rwjblue Documented in the new deprecations app in ember-learn/deprecation-app#106

Updated this PR so the URL points to the right anchor in the new app.

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.

2 participants