3

I am playing with tutorial Tour of Heroes found here. Everything runs and looks fine. However, after I added routing from root page to dashboard and to hero's detail, I got the following error in the console:

Unexpected condition on http://localhost:3000/dashboard: should only include this file once

The error is seen after I click in the link to Dashboard. The message is thrown from that line of code:

expect(!loadTimeData, 'should only include this file once');

in VM1812:155. JS version is V8 5.6.326.50. Version of Angular I am using is 4.0.0, as declared in package.json:

"dependencies": {
  "@angular/common": "~4.0.0",
  "@angular/compiler": "~4.0.0",
  "@angular/core": "~4.0.0",
  ...
}

dashboard.component.ts

import { Component, OnInit  } from '@angular/core';

import { Hero } from '../heroes/hero';
import { HeroService } from '../model/hero.service';

@Component ({
  selector: 'my-dashboard',
  templateUrl: './html/dashboard.component.html',
  styleUrls: ['./css/app.css'],
})

export class DashboardComponent implements OnInit {

  heroes: Hero[] = [];

  constructor(private heroService: HeroService) { }

  ngOnInit(): void {
    this.heroService.getHeroes()
      .then(heroes => this.heroes = heroes.slice(1, 5));
  }
}

The /dashboard page is linked in app.component template, like that:

<nav>
  <a routerLink="/heroes">Heroes</a><!--another page, also problematic-->
  <a routerLink="/dashboard">Dashboard</a>
</nav>
<router-outlet></router-outlet>

and route definition is defined in a module like that:

@NgModule({
  imports: [ RouterModule.forRoot(
    [
      { path: '', redirectTo: '/dashboard', pathMatch: 'full' },
      { path: 'dashboard',  component: DashboardComponent },
    ]
  ) ],
  //...
})

Anyone knows what this error means and why it pops up?

3
  • please post code that has your link in it and also route definition. Commented Mar 26, 2017 at 11:05
  • 1
    @banan3'14 did you solve it? What is your browser? Have the same problem with React Router Commented Mar 30, 2017 at 15:23
  • 1
    I did not solve it. My browser is Yandex 57 (it is based on Chromium, so it is basically akin to Google Chrome). I tried to open it in other browsers, but the app does not load (e.g. in Safari 5.1.7, which is not my default browser, I can see only Loading HeroComponent content here ...). Commented Mar 31, 2017 at 8:08

1 Answer 1

6

I checked with every browser and seems it applies only to Yandex browser. From my perspective, that bug needs to be sent to Yandex Support team. However, it doesn't affect end-user experience or any functionally. We can safely ignore it for now.

PS - angular application isn't working on old safari (5.1.7), use the latest one(9-10) which is available only on MacOS or any other modern browser.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.