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

Refine native class examples #234

Merged
merged 1 commit into from
Nov 17, 2019

Conversation

kategengler
Copy link
Contributor

Use the constructor in the application route. Avoid outdated bubbling route-actions.

Use the constructor in the application route. Avoid outdated bubbling route-actions.
@jrjohnson
Copy link
Contributor

@kategengler this example gives me an InternalError: "too much recursion" which seems to result from the router service being the same as the router we're constructing. Changing the code to:

this.on('routeDidChange', () => {
  const page = this.router.currentURL;
  const title = this.router.currentRouteName || 'unknown';

  this.metrics.track(page, title);
});

Seems to work and fix that issue.

@kategengler
Copy link
Contributor Author

@jrjohnson I have the code from the example verbatim in an app, and working, on 3.13.

which seems to result from the router service being the same as the router we're constructing

I'm not sure I understand this? This snippet is in the constructor of the Application Route, so we're not constructing a router.

@jrjohnson
Copy link
Contributor

Ah, I see a difference. The Octane blueprint and Ember 3.14 use:
import EmberRouter from '@ember/routing/router';
and this code has:
import Route from '@ember/routing/route';

Aside from the name of the import one is from router and one is from route. I have no idea which is correct.

@kategengler
Copy link
Contributor Author

@jrjohnson I think you are in the wrong file. This should be in app/routes/application.js not in app/router.js

@jrjohnson
Copy link
Contributor

😊 damn! Sorry for the noise. I've always had these instructions in router.js and I didn't even notice the difference. Super obvious why the import is different now too.

@josemarluedke josemarluedke merged commit fd63cc6 into adopted-ember-addons:master Nov 17, 2019
@josemarluedke
Copy link
Collaborator

Thank you @kategengler and @jrjohnson.

@kategengler kategengler deleted the patch-1 branch November 17, 2019 18:22
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

3 participants