2016-09-20 11 views
3

私は基本的にapp.jsのメインルータとダッシュボードjsの子ルータを持っています。私がルートのURLに行くときはいつでも、ブラウザのコンソールに警告が表示されます。リダイレクトは正しく動作し、すべてが表示されますが、私はまだ何かが間違っていると言っているこの巨大な警告を受け取ります。私は何が欠けていますか?どんな助けもありがたい。Aurelia-router with child-router shows

ブラウザのコンソール警告は

Warning: a promise was rejected with a non-error: [object Object] 
    at _buildNavigationPlan (http://localhost:9000/scripts/vendor-bundle.js:14942:22) 
    at BuildNavigationPlanStep.run (http://localhost:9000/scripts/vendor-bundle.js:14922:14) 
    at next (http://localhost:9000/scripts/vendor-bundle.js:14488:20) 
    at Pipeline.run (http://localhost:9000/scripts/vendor-bundle.js:14501:14) 
    at http://localhost:9000/scripts/vendor-bundle.js:16050:25 
From previous event: 
    at AppRouter._dequeueInstruction (http://localhost:9000/scripts/vendor-bundle.js:16023:32) 
    at http://localhost:9000/scripts/vendor-bundle.js:16014:17 
From previous event: 
    at AppRouter._queueInstruction (http://localhost:9000/scripts/vendor-bundle.js:16011:14) 
    at http://localhost:9000/scripts/vendor-bundle.js:15945:23 
From previous event: 
    at AppRouter.loadUrl (http://localhost:9000/scripts/vendor-bundle.js:15944:53) 
    at BrowserHistory._loadUrl (http://localhost:9000/scripts/vendor-bundle.js:11474:55) 
    at BrowserHistory._checkUrl (http://localhost:9000/scripts/vendor-bundle.js:11467:14) 

app.js

export class App { 
    configureRouter(config, router) { 
    this.router = router; 

    config.map([ 
     { route: '', redirect: 'dashboard' }, 
     { route: 'dashboard', name: 'dashboard', title: 'Dashboard', moduleId: 'views/dashboard', auth: true } 
    ]); 
    } 
} 

app.html

<template> 
    <require from="material-design-lite/material.css"></require> 
    <router-view></router-view> 
</template> 

dashboard.js

export class Dashboard { 
    configureRouter(config, router) { 
     this.router = router; 

     config.map([ 
      { route: 'fairs', name: 'fairs', title: 'Messen', moduleId: 'views/fairs', nav: true }, 
      { route: '', redirect: 'fairs' } 
     ]); 
    } 

    attached() { 
     componentHandler.upgradeAllRegistered(); 
    } 
} 

dashboard.html

<template> 
    <router-view></router-view> 
</template> 
+0

あなたの 'dashboard.js'接続メソッドで何かが失敗して、波紋が発生する可能性がありますか? – Andrew

+1

添付されたメソッドがなくても、同じエラーが発生します。リダイレクトから来ているのは確かです。なぜなら、/ urlにアクセスしたときにエラーが表示されるからです。 – QuantumDream

答えて

5

私は同じことに探していた、と私はそれが目的にそのように書かれていると思います。この警告を引き起こすコードは、AppRouterオブジェクトを構成する長年の約束に由来しています。

ステップに到達すると、リダイレクトステップはそのチェーンの別の方法でハンドリングされるため、アップストリーム(RedirectToRoute.navigate(...))がハンドリングされているため、その特定の約束は拒否されます。これは、スタックトレースを読み取った後の私の推測です。

私は警告がBluebird promise apiからコンソールに出力されていると仮定していますが、100%確実ではありません。

+1

私は実際にこれでかなり長い時間働いていましたが、同じ結論に達しました。違うものが拒否されるいくつかの場所があるように見えますが、これは「エラー」ではありません。実際に何かが間違っていることを意味するわけではなく、実装のデフォルト値です(aurelia-fetch-clientは実際にはデフォルトと全く同じことを行います)。私たちはちょうど今それらを無視する必要があります推測:)ありがとう – QuantumDream

関連する問題