Skip to content

Refactor references to willTransition (#1731)#1734

Merged
mansona merged 3 commits intoember-learn:masterfrom
rajakvk:remove-reference-willTransition
Nov 4, 2021
Merged

Refactor references to willTransition (#1731)#1734
mansona merged 3 commits intoember-learn:masterfrom
rajakvk:remove-reference-willTransition

Conversation

@rajakvk
Copy link
Copy Markdown
Contributor

@rajakvk rajakvk commented Sep 3, 2021

Closes #1731
Remove references to deprecated willTransition and add routeWillChange
@jenweber Please review

@bertdeblock
Copy link
Copy Markdown
Contributor

👋 Replacing willTransition with routeWillChange here isn't correct as Routes do not have the routeWillChange event. routeWillChange is an event on the RouterService.

Maybe it's a good idea to reuse that example here as well?

  • It uses constructor instead of init
  • It doesn't access the controller (accessing the controller outside of the setupController and resetController hooks is linted against)

The action import can be omitted though, it isn't used. I made a PR here to address this.

I think some of the copy around the code examples needs updating as well. For instance:

When a transition is attempted, whether via <LinkTo />, transitionTo, or a URL change, a willTransition action is fired on the currently active routes.

Could be updated to something like:

When a transition is attempted, whether via <LinkTo />, transitionTo, or a URL change, a routeWillChange event is fired on the RouterService.

Could be that some of the other copy needs a bit of updating as well.

@jenweber
Copy link
Copy Markdown
Contributor

jenweber commented Sep 9, 2021

Hi, thanks for your PR! I will review it this week. If anyone else has time to review sooner, please go for it. I need a little time to test the example in an app.

Copy link
Copy Markdown
Contributor

@jenweber jenweber left a comment

Choose a reason for hiding this comment

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

This is important prep for 4.0. Thank you!

When a transition is attempted, whether via `<LinkTo />`, `transitionTo`,
or a URL change, a `willTransition` action is fired on the currently
active routes. This gives each active route, starting with the leaf-most
or a URL change, a `routeWillChange` event is fired on the [RouterService](https://api.emberjs.com/ember/release/classes/RouterService/events). This gives each active route, starting with the leaf-most
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Suggested change
or a URL change, a `routeWillChange` event is fired on the [RouterService](https://api.emberjs.com/ember/release/classes/RouterService/events). This gives each active route, starting with the leaf-most
or a URL change, a `routeWillChange` event is fired on the [`RouterService`](https://api.emberjs.com/ember/release/classes/RouterService/events). This gives each active route, starting with the leaf-most

This change is to make the linter happy.

@mansona mansona force-pushed the remove-reference-willTransition branch from c3d814e to d5b3b2f Compare November 4, 2021 16:09
@mansona
Copy link
Copy Markdown
Member

mansona commented Nov 4, 2021

Percy is failing for some strange reason 🙈 I know what the issue is: the problem is that we have changed the browser since our last build on master 🙃

After we merge this the master will build again, and future PRs will be happy 🎉

@mansona mansona merged commit fed452c into ember-learn:master Nov 4, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Ember 4 prep - refactor references to willTransition and didTransition

4 participants