2017-11-10 33 views
1
これは私たちの親ビューである

親ビューにリダイレクト: http://localhost:8080/#/dashboard/ルーティング反応し、リフレッシュは、特定のビューをレンダリングしませんが、

私はメニューナビゲーションへのリンクをクリックすると: http://localhost:8080/#/dashboard/menu-navigation

これはアップロードされます正しいmenu-navigationビューですが、アプリを更新すると、menu-navigationの代わりに/dashboardに戻ります。メインRoutes.jsから

を使用すると、上記ロードされているメインコンポーネントに記録された後

const Routes =() => (
    <Provider store={store}> 
    <ConnectedRouter history={history}> 
     <Switch> 
     <Route path="/login" exact component={Login} /> 
     <Route path="/redirect" component={FirebaseRedirector} /> 
     <Route path="/restricted-access" component={RestrictedAccess} /> 
     <Route path="/change-password/:hash?" component={ChangePassword} /> 
     <Route path="/reset-password" exact component={ResetPassword} /> 
     <Route path="/" component={Main} /> 
     <Route path="*" component={NotFound} /> 
     </Switch> 
    </ConnectedRouter> 
    </Provider> 
); 

export default Routes; 

注:ここでは

render() { 
    return (
    <Main 
     user={this.props.user} 
     signOut={this.signOut} 
    > 
     <Switch> 
     <Route 
      path="/dashboard/categories/unmatched-api/:id?" 
      component={CategoriesUnmatchedApi} 
      notExact 
     /> 
     <Route path="/dashboard/menu-navigation" exact component={MenuNavigation} /> 
     <Route path="/dashboard/home-screen" exact component={HomeScreen} /> 
     <Route path="/dashboard/categories/product-config" component={CategoryProductConfig} /> 
     <Route path="/dashboard/categories/:category?" component={Categories} /> 
     <Route path="/dashboard/playground" exact component={Playground} /> 
     <Route path="/dashboard" exact component={Drafts} /> 
     <Route path="/" exact component={Drafts} /> 
     <Route path="*" component={NotFound} /> 
     </Switch> 
    </Main> 
); 
} 

はあなたに一度の状態でありますMenuNavigationルートにナビゲート

enter image description here

は、その後リフレッシュ

enter image description here

後の状態では、ルータが<Route path="/dashboard/menu-navigation"を尊重していないように思える反応しますか?

私はMain.jsルート区間を3回、this.props.locationが正しい初めて、しかし、次の2回、それは

enter image description here

だけ /dashboard

だがヒットされることをリフレッシュした後の通知をしました
+0

ルーターが初期化してルートの照合を試みた後でReduxストアがログイン情報をプッシュしていませんか? – FMCorz

答えて

0

それを実感してください!毎回/ダッシュボードへのリダイレクトがありました。

は、私たちが持っていた私達のログインアクション内部:

onAuthStateChange - これを含ま>checkAuth

dispatch(push(authDasboardView));

をauthDashboardViewに派遣を除去した後、この問題を修正しました!

関連する問題